poage@ucbvax.berkeley.edu (Tom Poage) (12/15/88)
I haven't tried this ... but I plan to real soon now :-).
To bring the system (down) to single-user for unattended
backups, try leaving a semaphore via cron or at:
cat /dev/null >/mymessage
/etc/reboot
In one of your rc files put something like
if [ -f "/mymessage" ]; then
rm -f /mymessage
# Hmm, security hole? vvvvv
/run/your/dump/backup.shell
# or run your C program with exec(dump).
/etc/reboot
fi
Tom.
Tom Poage, UCDMC Clinical Engineering, Sacto., CA
ucdavis.ucdavis.edu!sunny!{poage,root,postmaster,news}
ucbvax!ucdavis!sunny!{poage,root,postmaster,news}clt@sun.com (Charlie Tierney - Sun San Francisco SE) (12/15/88)
Actually the subject is performing automatic dumps in single-user mode (through the use of shell scripts). In fact, the write a "dot" file and check for it's presence is the best method to accomplish your goal. The old Fortune Systems 32:16 used to operate in this exact way for several maintenance commands. Let's say you want to do autodumps in single user mode. Your dump command starts from cron and does a: "touch /etc/.dump" "shutdown -r +5 'Dump is about to begin - you better get off.'" Eventually, after the reboot (see shutdown(8)), you will come through the rc scripts. The script to muck with is /etc/rc. In /etc/rc put in some lines that do about this: if test -f /etc/.dump then /etc/BACKUP rm /etc/.dump fi On the Fortune, it was a more generic capability - all unbundled software installed a startup/shutdown/install/delete shell script into a directory: "/m/maint/rc". The /etc/rc script looked at /m/maint/rc and ran each script it found there. Very clean, also nice to be able to deinstall something by typing: "/m/maint/rc/boring.rc delete' Charlie Tierney Sun Microsystems Writing In No Official Capacity