?
Solved

Running one job continuously between set hours.

Posted on 2004-09-20
4
Medium Priority
?
167 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
ID: 12107544
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
ID: 12107579
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 1200 total points
ID: 12108283
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
ID: 12113948
Duh! I never even thought of a file lock! That took all of four lines of scripting. :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

807 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