Solved

Running one job continuously between set hours.

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…

717 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