Operating System - HP-UX
1823116 Members
3309 Online
109646 Solutions
New Discussion юеВ

Scheduling an start-up for my system

 
JoseMi Latorre Valen
Occasional Advisor

Scheduling an start-up for my system

It's possible to program an start-up for my HP-UX disattended? I can launch a shutdown using cron, but if I want to restart my system automatically some hours later or at a time concrete, how can I achieve this?

Thank you
5 REPLIES 5
RAC_1
Honored Contributor

Re: Scheduling an start-up for my system

On GSP there is AR (automated recovery command), but it is more onto UPS and system restart etc.

If you put the machine in halt state, you can reset and bring it on from other system. In this case, you will be using a tool like expect to connect to GSP and do a system reset from there. This looks quite possible.

Anil
There is no substitute to HARDWORK
Muthukumar_5
Honored Contributor

Re: Scheduling an start-up for my system

Do you want to schedule your system reboot? If so put a script in cron to reboot it.

You can reboot -r -t
Easy to suggest when don't know about the problem!
Suraj Singh_1
Trusted Contributor

Re: Scheduling an start-up for my system

Well system startup automatically can be done, if you have a GSP/remote console.

As mentioned by RAC above, you would need to install EXPECT tool in one of your systems, and schedule a script which communicated with the GSP and issues a "PC -on" command to the system.

Regards,
Suraj
What we cannot speak about we must pass over in silence.
TwoProc
Honored Contributor

Re: Scheduling an start-up for my system

Look at the top line in the /etc/inittab.
What is your default init level?
My guess is that it is 3.
So, go to /sbin/rc3.d (if the default level is 4, then put in a 4.

Now, we're going to recreate HP's missing local.rc file that they use to provide - only with much less functionality. This file went away with HPUX 10.x, so I lived without it until version 11.11 - until I got a set of Linux boxes, and realized how much I liked having it - so I put it back myelf. This command runs "last" after your systems boots. I say "last" because the number that says it runs last is the "99" that I put in it. If there exists Sxxxx files in the /sbin/rc3.d directory that have a higher number - then it won't be last anymore.

Warning: the proper way to do this would be much better and make sure to run shutdown commands when you shutdown - this one doesn't. You can look at other Sxxfiles in this directory and take that up if you wish.

cd /sbin/rc3.d
touch S99rc.local
chmod 750 S99rc.local
chown root:bin S99rc.local

Now, vi S99rc.local and add the following lines...

#!/sbin/sh
#
# This is my very own rc.local replacement utility...
# HP must have forgot to put it back in. :-)
#
#Put the commands you want to run on boot up below here.


Now, put your command you want to run at the end of the file above.

Keep in mind a few things... this is "sh" not "ksh" or "bash". Also, you'll need to set up all of the environment variables needed to make your command run in the script you call (don't put them in the S99rc.local script). You'll have to put the full path to the command you want to run. If the program you're starting doesn't/shouldn't be run as root - you'll need to do an su command and pass a command line to the script you want to run, and if needed, you'll need to remember to set environment variables there before starting your programs.

If you're going to start services that you want shutdown automatically as well - then take a look at some of the other scripts in this directory to see how they do it. For example, the script for starting and stopping samba is very clean and easy to understand and use as a template if you have that installed.
We are the people our parents warned us about --Jimmy Buffett
Pete Randall
Outstanding Contributor

Re: Scheduling an start-up for my system

If this machine is connected to a UPS, you may be able the UPS to re-apply power to the machine at a particular time. Check your UPS documentation.


Pete

Pete