Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I setup by SCO server box to automatically restart once a week?

Status
Not open for further replies.
schedule a shutdown -i6 in cron.
make sure there are no bootable cdroms or diskettes in the machine.
why would you need to do this?
 
Certainly.

Now I suppose you want to know how..

note that if you habitually keep disks in the floppy drive or bootable CD's in the CD drive.. they will get in the way of a reboot to the hard disk.

Under OpenServer I like to add a line 'TIMEOUT=10' to help shorten the default 60 second timeout at boot time where the 'boot:' prompt waits for a keypress before auto-boot kicks in. I add this line to /etc/default/boot.

Use cron to schedule the time to reboot. 'man cron' for info, 'man crontab' for info on editing the files controlling cron.

heres a line to example rebooting every sunday night at 10:15pm:

15 22 * * 0 /etc/shutdown -g0 -y -i6

Now, I run OpenServer, so my example reflects that. -g0 means shutdown immediately, -y means answer yes to the 'shutdown now?' prompt, and -i6 means goto init level 6, which is a shutdown and reboot.


Now.. having said all that, there is really no reason you should ever need to have your SCO box doing automatic shutdowns.
 
I'm actually having a problem with my print scheduler. It stops running about once every two weeks for some reason. I was told that rebooting the server might aid in correcting this issue. I'm beginning to think I may have been mislead. Anyway if you know why this is happening and how to fix it, I would appreciate any insight you could give me. Thanks
 
Rather than reboot, it might be better to have a cronjob to check the status of the print scheduler on a regular basis and restart it if it's stopped. Something like:

ps -ef | grep lpsched
if [ $? = 1 ]
then
/usr/lib/lpsched
fi

might do the trick. Long term, however, it would be better to find the root cause of the problem. Cheers.
 
Jim, you can put the script anywhere as long as you reference it correctly in your cron job and make sure that it's executable using chmod. If you need help with that, post back. Cheers.
 
So I create the script, name it startprint, then I'm going to save the script in the /usr/lib/cron directory.


ps -ef | grep lpsched
if [ $? = 1 ]
then
/usr/lib/lpsched
fi

What changes do I need to input in this script? Also do I add the chmod commands directly to this script, or reference them somewhere else? Thanks
 
You shouldn't need to change the script at all. You chmod the script to make it executable, so:

cd /usr/lib/cron

chmod 755 startprint


Should do the trick for you. Do you need help with the cron entry - if so, bear in mind that this is a UK bank holiday and get back to me soon! Regards.
 
No. Issue the chmod from the command line in the directory the file is in, that will make the file executable. You'll then need to add a cron entry (using crontab -e) something like:

30 * * * * /usr/lib/cron/startprint

so that the script runs on the half hour of every hour on every day. HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top