Shutting down a Sun System with a Shell Script

Joe Michel-Angelo tekbspa!tss!joe at uunet.uu.net
Fri Dec 9 20:46:03 AEST 1988


STELLABO at CSHLAB.BITNET:
> Is there anyway to perform the following steps in a shell script from
> crontab on a Sun 3/280s file server: 
>         1) Bring the system down to single user with the Shutdown Command
>         2) umount the /usr file systems
>         3) Perform a level (1-9) on the /usr file system
>         4) Re mount the file systems.
>         5) Bring the computer up in multi user.

The problem with this idea is the single->multi user bridge. As you see,
it gets broken during the multi-single user transition. Don't know what
you can do about that... unless you have the source for shutdown(8).

You could always try a VERY buzzare method using file synchronization and
the bsd-stuff-chars ability (ie: the ioctl call that puts chars into the
clist).  Someone once posted stuff.c to this news group. I can't recall
the ioctl name.  (Leaving for Dallas tonight!!!)

Cron script would:

    using "stuff", stuff a login sequence into the console (if needed)
    after a root user is logged into the console, stuff "echo >
    /tmp/iamready"

    after /tmp/iamready exists, stuff "shutdown ... ; sleep 500 ; backup
    ... ; ^D"

The script would die when the root/console user runs shutdown, but the
sleep, backup, and re-enter multi user commands would be in a clist
someplace just waiting to be executed.

The above sequence won't work exactly as typed above. But the concept
should work.  You should know that it's never a good idea to have the root
password sitting around!

Personally, I'd not do this... too many problems would occure. 

Why not just backup /usr in multi-user mode? Perhaps tag /etc/nologin with
a "Sorry -- backups being run" and then a nice wall message: "Hey, backups
being run! Try not to edit anything!" ... Multi-user backups always work
for me.

	Joe Angelo -- Senior Systems Engineer/Systems Manager
	at Teknekron Software Systems, Palo Alto 415-325-1025
	joe at tss.com - uunet!tekbspa!joe - tekbspa!joe at uunet.uu.net



More information about the Comp.sys.sun mailing list