This shutdown script is an inversion of the startup script /etc/rc.local
Source Reference: http://ift.tt/2asSd7J
Create SYSTEMD configuration file
Code:
cat >/lib/systemd/system/SHUTDOWN.service [Unit] Description=/etc/rc.local.shutdown Compatibility Before=shutdown.target [Service] ExecStart=/bin/true ExecStop=/etc/RC-LOCAL-SHUTDOWN RemainAfterExit=yes [Install] WantedBy=multi-user.target
Note: Name of the file is derived for 'ExecStop' example above, but the name can be anything you desire.
Code:
cat >/etc/RC-LOCAL-SHUTDOWN # Enter whatever script commands here. # Example: date >/home/user/TODAYDATE.TXT
Code:
chmod -v 755 /etc/RC-LOCAL-SHUTDOWN
Code:
systemctl start RC-LOCAL-SHUTDOWN
Code:
systemctl enable RC-LOCAL-SHUTDOWN
[HOWTO] Ubuntu Variant 16.04 - Shutdown script for SYSTEMD
Aucun commentaire:
Enregistrer un commentaire