This shutdown script is an inversion of the startup script /etc/rc.local
Source Reference: http://forums.fedoraforum.org/showthread.php?t=301243
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
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
برچسب:
نویسنده: استخدام کار