Path: utzoo!attcan!uunet!husc6!im4u!woton!riddle From: riddle@woton.UUCP (Prentiss Riddle ) Newsgroups: comp.sys.att Subject: Re: Reboot UNIXPC from via cron Summary: Here's the script that we use. Keywords: reboot unixpc cron Message-ID: <1065@woton.UUCP> Date: 25 May 88 16:09:38 GMT References: <2597@mibte.UUCP> Organization: Shriners Burns Institute, Galveston Lines: 62 Re-Sock: "Bob" > Could you provide a method for be-booting a UNIX PC via a crontab entry or > some other means? Here's what we use. Suggestions or improvements welcome. ----------------------------------------------------------------------------- # niteboot.sh -- shell script to gracefully reboot the system # # This should be run nightly from /usr/lib/crontab, e.g.: # # 1 4 * * * /usr/bin/niteboot # # A nightly reboot seems to be necessary on the UNIX PC in order to # clear out bogus utmp entries, hung communications processes, messed-up # inittab lines, etc. # # We use this instead of /etc/shutdown because /etc/shutdown puts messages # in windows on the console and requires confirmation from a user; we use # it in place of straight /etc/reboot because we want to do some syncs and # issue a few warnings first. # # Bugs: /etc/wall seems to be unreliable on the UNIX PC -- even with "mesg y" # turned on, users don't seem to always get the message. Sigh. # # History: # 87.11.10 riddle Original version. # 87.11.19 riddle Fixed "/etc/sleep" bug. # cd / echo " \003System rebooting in 10 minutes -- log out now! \003System rebooting in 10 minutes -- log out now! \003System rebooting in 10 minutes -- log out now! \003System rebooting in 10 minutes -- log out now! \003System rebooting in 10 minutes -- log out now! " | /etc/wall sleep 540 cd / /usr/lib/lpshut > /dev/null 2> /dev/null echo " \003System rebooting in 1 minute -- log out now! \003System rebooting in 1 minute -- log out now! \003System rebooting in 1 minute -- log out now! \003System rebooting in 1 minute -- log out now! \003System rebooting in 1 minute -- log out now! " | /etc/wall sync;sync sleep 60 # sync;sync /etc/reboot ----------------------------------------------------------------------------- -- Prentiss Riddle ("Aprendiz de todo, maestro de nada.") -- Opinions expressed are not necessarily those of my employer. -- riddle%woton.uucp@cs.utexas.edu uunet!ut-sally!cs.utexas.edu!woton!riddle