Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!unmvax!bbx!yenta!dt From: dt@yenta.alb.nm.us (David B. Thomas) Newsgroups: comp.sys.3b1 Subject: Re: Single user mode Message-ID: <1991May6.160958.21766@yenta.alb.nm.us> Date: 6 May 91 16:09:58 GMT References: <337@ramecs.UUCP> Organization: yenta unix pc, rio rancho, nm Lines: 45 car@ramecs.UUCP (Chris Rende) writes: >When I use "/etc/shutdown" I get the message telling me to press RETURN >to reboot. I'd like the system to go into single user mode instead. >(With a shell). Then, "init 2" could be used to start the system back up. Ooooh ah _hate_ that! I set up two ways of dealing with that. #1 -- I changed /etc/profile so that I get a shell in single user mode, like normal unix: # /etc/profile trap '' 1 2 3 # the following fails if utmp is corrupt. need to devise a fix. set `who -r` # if we've just entered single-user mode, handle it specially if [ "$3" = "S" ] then echo Entering single-user mode... > /dev/syscon /bin/ps -el > /dev/syscon 2>&1 sync;sync;sync /bin/sh < /dev/syscon > /dev/syscon 2>&1 exit 0 fi #rest of /etc/profile here. That way, when entering single user mode, you just get a shell. You might have to kill processes by hand before you can reboot safely, though, since /etc/killall is no longer run. I use single user mode only for emergencies, or if I'm just about to reboot. Other than that, I have created an "admin" run level, which does not allow dial-in users, and which doesn't run cron or other daemons, but which does allow console and other local logins. I was going to post my inittab file, but I've done so many nonsklarkish hacks to it that I really can't post it without posting a bunch of other little shell scripts and things that work with it. I'd be happy to post or email if there is interest. little david still MGR hacking -- report soon! -- Unix is not your mother.