# Shutdown rcorder



## Leander (May 16, 2012)

Hi,

Since I currently have to run ZFS on top of md devices, I wonder about the order of shutting down services to prevent the service as well as ZFS from "crashing".

[cmd=]zpool create -f tank raidz1 /dev/md3 /dev/md4 /dev/md5 /dev/gpt/2TB-1 /dev/gpt/2TB-2[/cmd]

Additionally other services like samba, postfix, dovecot, [...] are using the ZFS Storage.

So generally I would need to ensure a shutdown order of something like this:


`service samba stop`
`service postfix stop`
`service dovecot stop`
`service [...] stop`
`zpool export tank`
`service md-zfs stop` (I wrote a script for this already)
umount regular UFS drives

Even though if I would have to write my own script which would do the shutdown of services in my wished order when system shutdown is invoked I still wonder

about an easier way to get to my goal - something like rcorder the other way around
or how I would enforce that even my own script will get called first of all before the others?
Thanks for hints.


----------



## phoenix (May 16, 2012)

Have a read through rc(8) and rcorder(8).

Basically, look at the output of `# rcorder /etc/rc.d /usr/local/etc/rc.d` to see the order things are started (top-to-bottom).  Then read that in reverse to see how things are shutdown.

All you have to do is edit the script that starts md and set it to *BEFORE: zfs*, or edit the script that starts zfs and set it to *REQUIRES: md*.

Everything else will happen automagically for you.


----------



## Leander (May 16, 2012)

phoenix said:
			
		

> Have a read through rc(8) and rcorder(8).
> 
> Basically, look at the output of `# rcorder /etc/rc.d /usr/local/etc/rc.d` to see the order things are started (top-to-bottom).  Then read that in reverse to see how things are shutdown.
> 
> ...




Thanks! I was hoping for this


----------

