Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I schedule a script to run every 10 minutes

Status
Not open for further replies.

akelabanda

Programmer
Dec 19, 2001
61
IN
Hi All

Is there a way to run a script every 10 minutes on a solaris box.

I'm afraid I will not be able to use crontab.

Can I use the "at command" for the same ?

I tried running by scripts as -

at now "+ 10 minutes"
>sh <script.sh>
><EOT>

But it just runs once.

Any help would be appreciated.

Thanks
Raj
 
Why can you not use a crontab?

Code:
0,10,20,30,40,50 * * * * /your/script

Annihilannic.
 
I guess you could put a sleep 600 at the end of your script, then get it to run itself again.
 
each user account can have its own crontab
(to access/create: crontab -e),
Therefore can you run scripts from your own user account?

However there is a time option on at command. See "man at
 
Thanks Guys

But, it looks like 'at' is useful for one time executions only.

I'll try crontab.

Cheers
 
If you can't use cron could you do something like this?

Make a wrapper script that calls that one every 10 minutes

#!/bin/sh
while true
do
your_script_name_here
sleep 600
done
 
You can also have the script call "at" on itself at the end to reschedule. That way, you don't have to worry about it getting killed off while its sleeping.
 
Thanks guys.

My problem's solved.

Since I had to run the scheduled job on five different servers, I put a controller script which runs ssh to kick off the 'at' schedule on the other servers once.

I've put a while loop and a sleep on the controller script itself, such that it starts every 10 minutes.

Thanks for all your inputs. Appreciate it.

Cheers
Raj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top