Solved

Running one job continuously between set hours.

Posted on 2004-09-20
4
159 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 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
networking details on centos 6.6 4 64
Reset Root Password on CentOS 6 4 56
installing docker on ubuntu 6 29
Web resource - Man pages for SUSE Enterprise Linux 11 1 26
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

803 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