LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 12-09-2012, 11:45 AM   #1
killout
LQ Newbie
 
Registered: Nov 2012
Posts: 14

Rep: Reputation: Disabled
[cron] Root cron ib centos 6.3 doesn't work/


Hello, kind forum.

My os is:

Code:
[root@livestreet var]# uname -a
Linux livestreet 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Code:
[root@livestreet var]# cat /etc/redhat-release
CentOS release 6.3 (Final)
And I can't get root cron to work.
After reading this doc ,I have added line to /etc/crontab:

cat /etc/crontab
Code:
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

0-59/1 * * * * root  ls /proc >> /tmp/proc
After that i have tried to restart crond, and reboot computer, but nothing happens.

Code:
[root@livestreet log]# tail /var/log/cron
Dec  9 20:01:01 livestreet CROND[4122]: (root) CMD (run-parts /etc/cron.hourly)
Dec  9 20:01:01 livestreet run-parts(/etc/cron.hourly)[4122]: starting 0anacron
Dec  9 20:01:01 livestreet run-parts(/etc/cron.hourly)[4131]: finished 0anacron
Dec  9 20:55:01 livestreet crond[3236]: (*system*) RELOAD (/etc/crontab)
Dec  9 21:01:01 livestreet CROND[4160]: (root) CMD (run-parts /etc/cron.hourly)
Dec  9 21:01:01 livestreet run-parts(/etc/cron.hourly)[4160]: starting 0anacron
Dec  9 21:01:01 livestreet run-parts(/etc/cron.hourly)[4169]: finished 0anacron
Dec  9 21:22:52 livestreet crond[4197]: (CRON) STARTUP (1.4.4)
Dec  9 21:22:52 livestreet crond[4197]: (CRON) INFO (running with inotify support)
Dec  9 21:22:52 livestreet crond[4197]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
Code:
[root@livestreet log]# tail /var/log/messages
Dec  9 03:13:02 livestreet rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="1078" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
And there is no file /tmp/proc

In my /etc/anacrontab there is no cron.hourly task like in this thread. Is that correct?
Code:
[root@livestreet etc]#  cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

Is /etc/crontab a right place for editing root cron jobs?
 
Old 12-09-2012, 12:49 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
First of all, before editing such important file, do take backup of it, so in case of any pb, it can be restored (I hope you did that).
Well, in order to add a cron job, you need NOT to manually edit /etc/crontab file, but you can simply open it for editing using cmd:
Code:
crontab -e

For example, to run a job daily at 3 pm, add:
0 15 * * * <command>
It will open the file in vi (or in your default editor), however add your cron job entry, save and quit.. That's all.
To check already running cron jobs, invoke:
Code:
crontab -l
(Note: I am not sure, what format is used for adding a cron entry in CentOS. So check the format of making a cron entry before any editing. Rest commands mentioned will work fine.)

Last edited by shivaa; 12-09-2012 at 12:58 PM. Reason: Note added
 
1 members found this post helpful.
Old 12-17-2012, 01:26 PM   #3
killout
LQ Newbie
 
Registered: Nov 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
The answer is new line at the end of /etc/crontab.

Cron began to works after adding new line next to last job.
 
  


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
Where are cron jobs located when not under /var/spool/cron/root? NotionCommotion Linux - Newbie 6 09-07-2012 07:33 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Fedora 8 selinux blocks root cron but not user cron Infinity Fedora 7 11-29-2007 08:21 AM
Resolving doesn't work with cron scardario Linux - Networking 1 09-19-2006 08:54 PM
Ssh Doesn't Work With Cron ? guano2 Linux - Networking 4 08-06-2005 12:57 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration