How about this method:
…pretty much:
This file
~/.config/systemd/user/before-shutdown.service
[Unit]
Description=Do stuff before shutdown
[Service]
Type=oneshot
RemainAfterExit=true
ExecStop=/home/esbon1253/scripts/epush.sh 'commit before shutdown'
[Install]
WantedBy=multi-user.target
Then do the things:
systemctl daemon-reload && systemctl --user enable before-shutdown.service
4 Likes