wow, that looks pretty much complicated!
let me explain my case...
i have a home server where /tmp is mounted as a tmpfs and i use it to save the lastpass-client cache.
it contains very sensitive data, so i think this is a good way to protect it if someone comes in and steals the pc: if that happens, the pc will be shut down and the cache directory in /tmp would be deleted (and, as far as i know, unrecoverable).
this way, however, the cache is lost when the system reboots after an upgrade, as well.
just before those reboots, therefore, i would move the /tmp/lpass_cache directory to $HOME, and then move it again to /tmp just after the reboot.
this is the command i'd like to run before the pc powers off:
Code:
[[ -d /tmp/lpass_cache ]] && mv /tmp/lpass_cache /home/user/
and then i would set a cron job like this:
Code:
@reboot [[ -d /home/user/lpass_cache ]] && mv /home/user/lpass_cache /tmp/
what do you think about?
i read some systemd service files documentation but i still haven't found how to run a command before the shutdown of a REBOOT sequence only...