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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a script on a timed intervel 1

Status
Not open for further replies.

nroberts420

Programmer
Jun 24, 2003
27
US
I have a linux server on a dynamic IP, I wrote a script that will get the IP address of the computer and then update a web site with the new address so I will be able to get to the server from anywhere. The only problem is I don't know how to make the script run on a timed intervel so I don't have to physically be at the server to run it. Is there any way to do this?
 
You need a crontab entry for this sort of thing - are you able to create cron entries?

To find out do the following:
Code:
# crontab -e

if you get a vi session then enter the following
Code:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/sbin/wall It works

then save and exit vi.

Wait about 5 minutes and if you see the message then, you do have access to run scripts from crontab.

As you can guess the first five space delimited values are WHEN to run the script. This example is set to run the wall command every five minutes. If you see it work, then quickly change the command to do what you are wanting.

Remember that crontab scripts need to have the FULL PATH FOR ALL COMMANDS AND FILES because they are not being run from your shell.

Good luck and hope that helps.

If you have any more questions - remember to use man crontab

Einstein47
("Vision without action is a daydream - Action without vision is a nightmare. Japanese Proverb")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top