I'm attempting to write a systemd service file that will call a script to rollback a zfs dataset at startup and at shutdown. The startup part is working great, but I keep getting kernel panics on the shutdown process.
I think that systemd is going ahead and shutting down something important before zfs can complete the rollback.
Does anyone have any suggestions? Here is my current service file.
[Unit] Description=Public Rollback Service After=zfs.target Requires=zfs.target [Service] Type=oneshot ExecStart=/bin/sh /usr/local/bin/public_rollback.sh RemainAfterExit=True ExecStop=/bin/sh /usr/local/bin/public_rollback.sh [Install] WantedBy=multi-user.target
The script that it is calling is just:
#!/bin/sh if zfs rollback $(zfs list -H -o name -t snapshot -r tank/public | tail -1); then exit 0 else echo "Could not rollback public dataset! Aborting." 1>&2 exit 1 fi