Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: tekbspa!tss!joe@uunet.uu.net (Joe Michel-Angelo) Newsgroups: comp.sys.sun Subject: Re: Shutting down a Sun System with a Shell Script Message-ID: <596@tekbspa.UUCP> Date: 9 Dec 88 10:46:03 GMT References: <8811102135.AA09427@rice.edu> Sender: usenet@rice.edu Organization: Rice University, Houston, Texas Lines: 45 Approved: Sun-Spots@rice.edu Original-Date: 24 Nov 88 03:56:55 GMT X-Sun-Spots-Digest: Volume 7, Issue 39, message 1 of 13 STELLABO@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@tss.com - uunet!tekbspa!joe - tekbspa!joe@uunet.uu.net