NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: corrupt /etc: how to gracefully shut down?



hhaamu%gmail.com@localhost writes:

> It's important to unmount the filesystems cleanly and shut down
> anything else that would otherwise appear 'dirty' at next boot.
> Anything to avoid a hard shutdown.

Agreed that you should try but power failures and hardware failures
happen and it's almost always not terrible.

I think you are right that trying to write to the USB drive is probably
not a good plan.

> Would there be a list of commands I can run to manually shut down as
> much as possible?

The shutdown stuff is really not magic.  It's just organizing a sequence
of operations, and encoding how to find the pidfile or whatever for each
one.

I would just run "ps aux" and see what's running and figure out how to
shut down each one.  If it isn't something datbasish a simple kill of
the PID is probably fine.  Read the rc.d scripts on another machine or
your backup, but 90% it's read the pid out of pidfile and send SIGTERM
and the program catches that and shuts down cleanly.

Keep doing this until everything daemonish (except sshd that you are
logged in via!) is shut down.

I'd do nfsd first, and rpcbind/mountd.

Once you have all daemons except ssh shut down, you can probably unmount
the data directories.

You might also then run swapoff, if you have swap configured.  (by
'run', I mean read the script in backups and then do those things)   My
experience is that raidframe can be left dirty if swap had it open.

keep tidying as much as you can and then run shutdown, maybe

(sleep 120; halt) < /dev/null > /dev/null 2>&1
shutdown -p now

and then wait 5 minutes and pull power.


Home | Main Index | Thread Index | Old Index