Operating System - HP-UX
1829735 Members
1873 Online
109992 Solutions
New Discussion

trying to use cron to shutdown L2000.

 
matthew mills
Frequent Advisor

trying to use cron to shutdown L2000.

I am getting the error ???Shutdown cannot be run from a mounted file system -- exiting shutdown. Change directories to the root volume ("/" will work) and try again.???

Root home directory is /home/root

This is my ???root??? crontab.

00 6 * * * /usr/sbin/shutdown -ry 0 1> /home/root/restart.log 2>
/home/root/restart_error.log #daily restart

I also tried:
00 6 * * * /usr/bin/cd / ; /usr/sbin/shutdown -ry 0 1> /home/root/restart.log 2> /home/root/restart_error.log #daily restart


Thanks In advance:
6 REPLIES 6
Jean-Luc Oudart
Honored Contributor

Re: trying to use cron to shutdown L2000.

Your output goes onto the /home file system. This might be the problem (/home is busy !)

Jean-Luc
fiat lux
Pete Randall
Outstanding Contributor

Re: trying to use cron to shutdown L2000.

Are you re-booting every day? Why?

Anyway, try using at instead:

at 0600 tomorrow
cd /
shutdown -r -y 0
D

Pete

Pete
Paula J Frazer-Campbell
Honored Contributor

Re: trying to use cron to shutdown L2000.

Hi

A reboot every day is not good practice - search the forum for lots of posts on this.


You need to be at / to reboot and not in roots home dir if it is different from /.


So in your routine you need a :-

cd

Hth

Paula
If you can spell SysAdmin then you is one - anon
Paula J Frazer-Campbell
Honored Contributor

Re: trying to use cron to shutdown L2000.

Hi

Check out this limk:-

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf679dfe5920fd5118fef0090279cd0f9,00.html

Paula
If you can spell SysAdmin then you is one - anon
Pete Randall
Outstanding Contributor

Re: trying to use cron to shutdown L2000.

A little enhancement to my previous suggestion:

Make a script called /re_boot and put the following in it:

cd /
shutdown -r -y 0
echo "/re_boot" |at 0600 tomorrow

Then, kick it off manually the first time and it will re-propagate itself from then on.

Pete

Pete
T G Manikandan
Honored Contributor

Re: trying to use cron to shutdown L2000.

you can just create a script which first changes the dir to / and then does a shutdown.

you cannot shutdown a system from /home or /opt.you should be in /

so

#this is script "example.sh"

cd /
/usr/sbin/shutdown -ry 0 1> /home/root/restart.log 2>
/home/root/restart_error.log #daily restart


So in your cron
0 6 * * * example.sh

THis is work


Thanks