LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-02-2009, 07:17 AM   #1
narendrakumar
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Rep: Reputation: 0
Cron is not working


Hi please have a look in the following scenario:

I gave an entry in /etc/crontab as follows:
35 11 * * * root find /tmp/* -mtime +1 -exec rm -f {} \; > /etc/test/cronlog.log

after this, from someone suggestions i restarted crond available under /etc/init.d/crond restart

even after this no result...then i checked /var/log/cron log file...there i could see the following:

Oct 2 11:35:01 vsl001a004 crond[3223]: (*system*) BAD FILE MODE (/etc/crontab)


no result from the above stuff..can someone tell me what could be the reason and solution for this.

Thanks
 
Old 10-02-2009, 07:34 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,526

Rep: Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503
Hi and welcome to LQ

You can put your command in a script and use crontab to run the script instead.
Mind that is always better to use absolute pathnames for commands and scripts in crontab, like "/usr/bin/find ...", /path/to/my/script.sh"

Regards
 
Old 10-02-2009, 07:53 AM   #3
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Are you editing the /etc/crontab file directly? what are the permissions set on that file? They should be set to 644. if not, i'd advise you change it.

Also, just in case you were editing the file directly, if you need to make an entry for cron, you should use the 'crontab -e' command.

HTH.
-RN.
 
Old 10-02-2009, 08:13 AM   #4
donanap
Member
 
Registered: Sep 2008
Location: Perth, Australia
Distribution: RedHat, Solaris
Posts: 38

Rep: Reputation: 15
Lightbulb How are you editing your crontab?

Hi,

Instead of going in and editing the /etc/crontab file directly, have you tried editing your crontab by doing the following?
Code:
crontab -e
This will open up the crontab file in vi. As you save it, it will confirm if the syntax is correct, if so, it will save it and add an entry, if not it will reject your effort.

Good Luck,
Donanap
 
Old 10-02-2009, 08:48 AM   #5
Ralfredo
LQ Newbie
 
Registered: Mar 2009
Posts: 17

Rep: Reputation: 0
The error message is:

Quote:
Originally Posted by narendrakumar View Post
Oct 2 11:35:01 vsl001a004 crond[3223]: (*system*) BAD FILE MODE (/etc/crontab)
So i guess there's something wrong with permissions and/or ownership of the file. On my machine (Debian/Lenny) the right permission are:

Code:
-rw-r--r-- 1 root root 718 2008-11-23 07:40 /etc/crontab
My guess is that crond (wisely) refuses to trust the file if anyone else than root has the ability to alter the contents of the file.
 
Old 10-02-2009, 09:14 AM   #6
narendrakumar
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
After changing permissions it works fine

Thanks a lot..After changing permissions it works fine...

Narendra
 
Old 10-02-2009, 11:51 AM   #7
narendrakumar
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Can someone suggest best practices on unix administration and please provide some links if you find.#

Thanks
Narendra

Last edited by narendrakumar; 10-02-2009 at 11:52 AM.
 
Old 10-02-2009, 11:52 AM   #8
narendrakumar
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
unix administration - best practices

Can someone suggest best practices on unix administration and please provide some links if you find.

Thanks
Narendra
 
Old 10-02-2009, 08:23 PM   #9
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by narendrakumar View Post
Can someone suggest best practices on unix administration and please provide some links if you find.

Thanks
Narendra
1. Open a Web browser.

2. Type "google.com" in the address bar.

3. Type your inquiry.

4. Press the Enter key on your keyboard.

Imagine the time saved compared to asking us, and us asking Google.
 
  


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 not working? elija Slackware 3 09-26-2009 09:13 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron not working adnanm Linux - Software 3 07-24-2007 08:50 PM
cron.daily, cron.weekly not working mwhite74 Linux - Server 2 06-07-2007 10:51 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM


All times are GMT -5. The time now is 06:19 AM.

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