[comp.sys.att] Reboot UNIXPC from via cron

twh@mibte.UUCP (Tim Hitchcock) (05/24/88)

> Posted for a friend.

Could you provide a method for be-booting a UNIX PC via a crontab entry or
some other means ? I've been told that the normal method using crontab will
not work because of the program /etc/smgr, which performs the functions
handled by crontab in other systems. Is this true ? Is there some way to
use smgr to reboot the system at night ?

> Thanks in Advance

jbm@uncle.UUCP (John B. Milton) (05/25/88)

In article <2597@mibte.UUCP> twh@mibte.UUCP (Tim Hitchcock) writes:
>> Posted for a friend.
>
>Could you provide a method for be-booting a UNIX PC via a crontab entry or
>some other means ? I've been told that the normal method using crontab will
>not work because of the program /etc/smgr, which performs the functions
>handled by crontab in other systems. Is this true ? Is there some way to
>use smgr to reboot the system at night ?

How about this one:
0 4 * * * /bin/su root % /etc/reboot

It will, of course,

 #    #   ####    #####
 ##   #  #    #     #
 # #  #  #    #     #
 #  # #  #    #     #
 #   ##  #    #     #
 #    #   ####      #

flush the disk buffers or do anything else nice :)

John

P.S. If you are so stupid as to actually do this, don't [bf]lame me
-- 
John Bly Milton IV, jbm@uncle.UUCP, {ihnp4|osu-cis}!n8emr!uncle!jbm
home: (614) 294-4823, work: (614) 459-7641; talk to me about fractals

riddle@woton.UUCP (Prentiss Riddle ) (05/25/88)

> 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