Cael
01-07-2002, 07:19 AM
I would like to set my server to remove files in /tmp everyday. I would like to use cron for this task. So can anyone tell me the step-by-step of what I need to do?
Thank you.
Thank you.
![]() | View Full Version : How to set a cron job? Cael 01-07-2002, 07:19 AM I would like to set my server to remove files in /tmp everyday. I would like to use cron for this task. So can anyone tell me the step-by-step of what I need to do? Thank you. zupanm 01-07-2002, 10:27 AM crontab -e as the root user then insert * 0 * * * rm -rf /tmp/* Varun Shoor 01-07-2002, 01:10 PM Originally posted by zupanm crontab -e as the root user then insert * 0 * * * rm -rf /tmp/* Haha right on :) do "man crontab" RutRow 01-07-2002, 02:03 PM Originally posted by zupanm crontab -e as the root user then insert * 0 * * * rm -rf /tmp/* Ouch... don't you mean 0 0 * * * rm -rf /tmp/* Your version will run every minute between midnight and 1 AM. ;) Noldar 01-07-2002, 02:40 PM If you're running Red Hat you might want to take a look at the tmpwatch program. It helps keep your /tmp directory nice and tidy :D I'm not sure if other distros have this or not. Do a man tmpwatch for instructions. Richard Cael 01-08-2002, 01:32 AM Originally posted by RutRow Ouch... don't you mean 0 0 * * * rm -rf /tmp/* Your version will run every minute between midnight and 1 AM. ;) Ok, now I am confused :( ... Whose is correct? priyadi 01-08-2002, 05:01 AM Originally posted by Noldar If you're running Red Hat you might want to take a look at the tmpwatch program. It helps keep your /tmp directory nice and tidy :D I'm not sure if other distros have this or not. Do a man tmpwatch for instructions. Richard Actually if you run RedHat you don't have to do anything about it. RedHat by default run tmpwatch automatically every day. It is probably not a good idea to rm -rf /tmp/*, as some process might still be using temporary files at the time of deletion. Tmpwatch is safe however, as it will only delete old files that probably is not being used anymore. |