LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-31-2006, 05:30 AM   #1
heeru
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Rep: Reputation: 0
cron job questions


I was reading up on cron jobs and am not sure where exactly we need to set this up? Which file?

I put entries in the /etc/crontab file, will that work?

A simple command like rm -rf <filename> gets executed in the above crontab file.

However, a command like
"10 4 * * * root find /usr/local/phoneweb/logs -name "pw_metricsfile*" -mtime +7 -exec rm -f {} \;" does not delete the files even after 10 days.

Any help will be appreciated. Thanks!
 
Old 03-31-2006, 06:43 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
that should be fine, but the syntax of the actual command to run get's confused easily. personally i would make a seperate script file with a useful name, i'd guess something like /var/scripts/rm_old_phoneweb_logs.sh, and just call that script on it's own from the crontab file. just make that script executable and you'll get a better level of clarity an abstraction in your crontab as it can just get really messy anyway.
 
Old 03-31-2006, 06:47 AM   #3
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
You typically need to do
crontab -e
to edit the crontab settings for your user.
You can also do:
crontab some_file
where some_file contains your crontab settings.
The /etc/crontab* stuff is done for system-wide cron jobs (ie logwatch & logrotate). Only root can probably use those. But root can have his own crontab settings too.

Crontab settings (per user, not for the entire system) are typically stored in /var/spool/cron or something like that. On my FC3 box, /var/spool/cron contains a file with the cron settings from one specific user. The file has the same name as the user.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job questions.... chunlee Linux - Software 1 02-18-2005 05:51 AM
need help with cron job parthcorp1 Linux - General 2 02-01-2005 11:37 AM
cron job the_rhino Linux - Newbie 10 10-02-2004 03:34 PM
Cron job rajasekarvr Linux - General 4 05-03-2004 05:35 PM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration