[HOWTO] Ubuntu Variant 16.04 - Shutdown script for SYSTEMD

ساخت وبلاگ

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
Create local shutdown script.
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

feed all...
ما را در سایت feed all دنبال می کنید

برچسب : نویسنده : استخدام کار feedoll بازدید : 267 تاريخ : شنبه 16 مرداد 1395 ساعت: 8:24