1820263 Members
2571 Online
109622 Solutions
New Discussion юеВ

Re: cron job

 
zsujith
Frequent Advisor

cron job

Hi All,

I have sheduled a cron job in HP server for system reboot. But it doest run last time.
Could you please help me to find out why it was not run.
Following is the cron entry.

01 14 * * 0 /etc/shutdown -ry 0


Sujith
"The most wasted day is that in which we have not laughed."
16 REPLIES 16
Johnson Punniyalingam
Honored Contributor

Re: cron job

<Following is the cron entry>>

what does you cron log shows..?

/var/adm/cron/log ..?

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Suraj K Sankari
Honored Contributor

Re: cron job

Hi,

You give the wrong path.

>>01 14 * * 0 /etc/shutdown -ry 0

/usr/sbin/shutdown -ry

Suraj
zsujith
Frequent Advisor

Re: cron job

Hi,
It seems ok..
$ ls -l /etc/shutdown
lrwxr-xr-t 1 root sys 18 Apr 22 2008 /etc/shutdown -> /usr/sbin/shutdown
$ ps -ef |grep -i cron
root 1596 1 0 Nov 9 ? 0:52 /usr/sbin/cron
"The most wasted day is that in which we have not laughed."
Johnson Punniyalingam
Honored Contributor

Re: cron job

Hi Suraj,

>>You give the wrong path.>>

nothing wrong in the path

see below my crontab "which i am shutdowing the server every -week end"

# crontab -l
15 08 * * * /opt/omni/lbin/check_back.sh
#00,5,10,15,20,25,30,35,40,45,50,55 21-23 * * * /var/adm/crash/perf/test.sh
0 9 * * 1-5 /home/ibmadm1/hc.sh 1>/dev/null 2>/dev/null
# Green IT - Server shutdown every Sunday 2000hrs
0 20 * * 0 /etc/shutdown -hy

# date
Mon Nov 17 12:09:22 SST 2008
# ll /etc/shutdown
lrwxr-xr-t 1 root sys 18 Jun 23 2005 /etc/shutdown -> /usr/sbin/shutdown
#
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: cron job

sujith,

did you manged to check on cron logs, what does its says

Thnx
Johnson
Problems are common to all, but attitude makes the difference
zsujith
Frequent Advisor

Re: cron job

Hi,

I have not found any entries at 14:01 ..

root 18856 c Sun Nov 16 14:00:00 CST 2008
< root 18856 c Sun Nov 16 14:00:00 CST 2008
> root 20394 c Sun Nov 16 14:05:00 CST 2008
< root 20394 c Sun Nov 16 14:05:00 CST 2008
"The most wasted day is that in which we have not laughed."
Johnson Punniyalingam
Honored Contributor

Re: cron job

more /var/adm/cron/cron.allow --> output

need check double confirm "root" added to cron.allow file
..?

also please check "syslog" for Sun Nov 16 14:00:00 CST 2008..?

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
zsujith
Frequent Advisor

Re: cron job

$ more /var/adm/cron/cron.allow
root
And There is no entries in syslog for this time
"The most wasted day is that in which we have not laughed."
Johnson Punniyalingam
Honored Contributor

Re: cron job

do you have cron.deny file ..?

If only the cron.deny exist and is empty,all users can use crontab.file exists only the root user can use the crontab

if you till face some problem

restart the crontab

/sbin/init.d/cron stop

cd /usr/lib/cron
mv FIFO FIFO.old

/sbin/init.d/cron start

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
zsujith
Frequent Advisor

Re: cron job

Hi Johnson,
The fifo file shows zero bytes.
Can you tell me wt is FIFO file.

prw------- 1 root root 0 Nov 14 21:24 FIFO
"The most wasted day is that in which we have not laughed."
Johnson Punniyalingam
Honored Contributor

Re: cron job

cron reads a message from the FIFO only when there are no jobs to
execute at the current time. If there are any child processes (jobs)
running, the FIFO read will be delayed.

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Sunny Jaisinghani
Trusted Contributor

Re: cron job

Hello All,

is it ok if we update the crontab using vi.

what difference does it make if we use vi and crontab -e to edit the crontab

i had a same situation where the cronjob did not run after i edited the crontab using vi

do i have to restart the cron??

Sunny

Re: cron job

Hi,

Sunny -> after you edited cron with vi you should restart cron.

Editing with crontab -e command doesn't require restart.

Regards,
Michal
Johnson Punniyalingam
Honored Contributor

Re: cron job

Hi Sunny Jaisinghani ,

>>i had a same situation where the cronjob did not run after i edited the crontab using vi >>

by editing crontab using " crontab -e " will helps to refresh crontabs by itself

(i mean you will getting message at the bottom when wq! some thing like Commands will excuted by root")

vi -> doesn't do that for you ,

hope you understand

Thx
Johnson
Problems are common to all, but attitude makes the difference
Sunny Jaisinghani
Trusted Contributor

Re: cron job

Thanks Michal and john
Dennis Handly
Acclaimed Contributor

Re: cron job

>Johnson: nothing wrong in the path

It is probably better to use the correct path than the tlink. They were planned to be removed for 11.31.

>mv FIFO FIFO.old

I've never needed to do this.

>Sunny: is it ok if we update the crontab using vi?

No, you should never do this directly. As Michal and Johnson said, only use crontab(1).