Solved

Running one job continuously between set hours.

Posted on 2004-09-20
4
156 Views
Last Modified: 2013-12-16
I have a script that, every night, chooses a network from a supplied list, and runs a series of scripts against it. The purpose of the script is supposed to be slow vulnerability assesment as well at network mapping and inventory control. The problem is, scanning one network per night is TOO slow.

The script is set up so that every time it is run, it selects a new network from the list. What we'd like to do is run it multiple times per night, but more efficently than at fixed intervals, so that if one network that gets scanned and has nothing on it only takes 15 minutes, then next network, which may take hours, fires off right away.

I have thought to make a wrapper that checks for running processes every x minutes and fires the script if nothing is found, but I was wondering if there was a better way to do it with cron or at.

Any suggestions? Only one instance can be run at a time, and we want to start as many as prudent between certain hours, especially when we get into long groups of mostly-empty networks.
0
Comment
Question by:mromanek
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Luxana
Comment Utility
cron will be better option. You need to edit /etc/crontab and also have a look
#man crontab

cron is cheking his jobs every minute
0
 
LVL 10

Expert Comment

by:Luxana
Comment Utility
how long it take when on network is something?
and hoe many networks you want to scan?
0
 
LVL 40

Accepted Solution

by:
jlevie earned 300 total points
Comment Utility
What I think I'd do is to run a script from cron every 5 minutes during the window of execution that checks a given directory for a "flag" file and if that file isn't present the script fires off the scan script. Each time the scan script starts it creates the "flag" file and deletes that file when done.
0
 

Author Comment

by:mromanek
Comment Utility
Duh! I never even thought of a file lock! That took all of four lines of scripting. :)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now