wingard@ncrcae.Columbia.NCR.COM (Steve Wingard) (02/28/89)
I'm working on a set of utilities to run under System V.3.2 that require, among other things, the ability to change a system's run level "on the fly". The problem I'm having is due to the fact that I need to preserve (from being killed) the particular program or utility that has invoked the run level change procedure. I envision a shellscript using this procedure in the following manner: . . . echo "System is changing to run level 0" *** /usr/bin/runlevel 0 *** # system goes to mode 0 now, but we stay # around (perhaps check return status) echo "System is now in run level 0" # perform activities in level 0 . . . where /usr/bin/runlevel would perform steps like: # Preliminary setup /etc/init $1 # Cleanup and status checking There's some fudging with the files in /etc/rc[0-6].d that can be done, but that doesn't do the whole job. Aside from that, it looks like I'd be stuck with finding the controlling tty for the procedure and hacking around with that terminal's entry in /etc/inittab to make that tty's entry spans the run level we're in now and the run level we're going to. And if (horrors) the process calling this utility has been separated from a tty (running through cron or at, for instance), then this method won't work. Anybody have any insights on how this might be accomplished? Is a special-purpose home-grown version of init the only way? E-mailed responses are fine, unless this is a topic of universal interest. Thanks... Steve Wingard ...{hp-sdd|ucsd}!ncr-sd!ncrcae!wingard NCR Corp., E&M-Columbia ...!gatech!hubcap!ncrcae!wingard W. Columbia, SC wingard@ncrcae.NCR.COM