对于旧的好SystemV脚本,如果我在关闭前想要一些东西,我将这样的脚本放在/etc/rc0.d/
K400rc.local.shutdown.sh我编辑它并放置我想要在关机前运行的命令。在带有systemd的linux上,我创建了这样一个“清单”
vim /lib/systemd/system/rc-local-shutdown.service
[Unit]
Description=/etc/rc.local.shutdown Compatibility
ConditionFileIsExecutable=/etc/rc.local.shutdown
DefaultDependencies=no
After=rc-local.service basic.target
Before=shutdown.target reboot.target
[Service]
Type=oneshot
ExecStart=/etc/rc.local.shutdown
StandardInput=tty
RemainAfterExit=yes
[Install]
WantedBy=shutdown.target在关机前工作非常good..and,我可以放置命令。is..someone知道如何使用Solaris执行这样的清单吗?我知道如何执行rc.local,但不知道如何执行rc.local.shutdown清单。有人知道吗?
发布于 2019-02-14 12:46:04
Solaris smf尊重遗留脚本,因此/etc/rc0.d/K400rc.local.shutdown.sh将在关机时执行。前缀K40和后缀.sh是唯一重要的部分,其余的0rc.local.shutdown对操作系统没有任何意义。
如果您希望将此任务转换为smf服务,而不是考虑关闭和运行级别,最好确定您的服务将依赖什么(您的服务将在所选服务结束后停止)。
然后使用非操作启动exec-method创建一个清单,并使用您的关闭脚本作为停止exec-method。
https://unix.stackexchange.com/questions/500547
复制相似问题