From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <8ba2d4c68bc57cff06a1d25a83434ca2@collyer.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] halting fossil (patch wannabe) From: Geoff Collyer In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Mon, 3 Nov 2003 15:06:06 -0800 Topicbox-Message-UUID: 7e734dfa-eacc-11e9-9e20-41e7f4b1d025 I have a more ambitious halt command that shuts down fossil and venti and syncs kfs. It helps that I'm running off of Ken's fs, otherwise one would want to rearrange the order of things to shutdown the service that serves the main file system last. #!/bin/rc # halt - sync (flush) and, if possible, halt all file servers rfork e cd / # fossil first, since it lives on venti. # fossil is damned hard to shut down cleanly and # without losing blocks. f=/srv/fscons if (test -e $f) { echo -n 'fossil (takes a while)...' for (n in `{seq 1 3}) { echo -n sync... echo fsys main sync >>$f # must be >> sleep 3 } echo -n sync... echo fsys main sync >>$f # must be >> echo halt echo fsys main halt >>$f # must be >> } # venti next, since it may live on kfs echo -n venti... venti/sync # upon return, sync is done, not just started kfs = `{ls /srv/kfs*.cmd >[2]/dev/null} if (! ~ $#kfs 0) { echo -n kfs sync... disk/ksync sleep 2 kfs = `{ls /srv/kfs.*.cmd >[2]/dev/null} if (! ~ $#kfs 0) { echo -n aux. kfs halt... for (i in $kfs) disk/kfscmd -n `{echo $i | sed 's%/srv/kfs.(.*).cmd%\1%'} halt } if (test -r /srv/kfs.cmd) { echo main kfs halt... disk/kfscmd halt sleep 2 } }