Forum Home
Press F1
 
Thread ID: 29737 2003-02-01 00:49:00 Linux command on a timed basis Chilling_Silence (9) Press F1
Post ID Timestamp Content User
117527 2003-02-01 00:49:00 Im wanting to know if its possible to setup linux to run a command on a timed basis...

So that once every, say, 30 minutes, It will execute this command, wait another 30 mins... execute the command.. and it just keeps going, either until its stopped, or even if I have to restart the machine to stop it...

Is it possible without installing any software?? Like making a .bat file sorta thing!


Cheers


Chilling_Silence
Chilling_Silence (9)
117528 2003-02-01 00:57:00 You want a cron script. Try "man 5 cron" and have a read of that. segfault (655)
117529 2003-02-01 01:56:00 Its under "man 5 crontab" on my system (mandrake).

You could just stick the script in /etc/cron.hourly if its frequent enough. Just make sure you remove any backups your editor creates because everything in there set as executable is run.
bmason (508)
117530 2003-02-01 02:02:00 so I could just use vi to edit that file and put in something like:
"service samba restart"
without the speech marks and it'll go??
Chilling_Silence (9)
117531 2003-02-01 05:16:00 To run it every 30mins adding a line like this to the end of /etc/crontab should work:


*/30 * * * * service samba restart



If you prefer a graphical interface "kcron" should work.


BTW, why do you need to restart samba??
bmason (508)
117532 2003-02-01 05:21:00 >
> BTW, why do you need to restart samba??

Err... I dont, it was just an example :-)

Thanks a lot guys :D
Chilling_Silence (9)
1