[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: need help on shell programming

On Thu, Feb 26, 2009 at 04:54:28PM -0500, Long Wind wrote:
> I want a script.
> The script run a command, wait one minute,
> then run the command again, wait one minute again
> ... again and again ...
> Thanks!

Just to bring this back up, you can use a mix of shell programming and
Cronjobs. For example, run your job like so;

*/1 * * * * script.sh

and have the script do some process checking:

#! /bin/sh

if [ $(ps aux | grep script.sh | grep -v grep) ]; then
 <your script here>

That will make sure it runs every minute, without overlapping itself.
When I write code that needs to be run a preset amount of time, I
generally try to find a way to use Cron -- why recreate what is already


Attachment: signature.asc
Description: Digital signature

Reply to: