Solved

Running one job continuously between set hours.

Posted on 2004-09-20
4
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to use question mark (?) in filename with html 25 134
Apache LDAP Authentication 20 72
rsyslog raw message 4 60
How ldap located a Domain controller? 22 77
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

734 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