- Ensure the script that you want to run at shutdown is executable:
chmod +x autoupdate.sh
- Move file
pre-shutdown.service
toetc/systemd/system
- Change exact directory in this
.service
file - Reload systemd, enable the service so it starts at boot time, then start it up:
sudo systemctl daemon-reload
sudo systemctl enable pre-shutdown.service
sudo systemctl start pre-shutdown.service
- Check everthing is ok:
sudo systemctl status pre-shutdown.service