我尝试将Debian上使用的SysVintit脚本(以及LinuxMint和Ubuntu&Co.等衍生产品发行版)转换为Fedora或ArchLinux(以及Bridge或Manjaro等衍生发行版)上使用的系统服务,但即使是systemd启动系统比以前更加高效和多功能,我不明白如何制作简单的东西,比如在命令行上使用"可选"参数,如ExecStart =或ExecRestart =!
以下是我对SysVinit所做的事情:
#!/bin/sh
### BEGIN INIT INFO
# Provides: myprog
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: myprog init script
# Descripton: this script manages myprog
### END INIT INFO
# exit if myprog isn't installed
[ -x "/opt/mystuff/myrpog" ] || exit 0
case "$1" in
start)
cd /opt/mystuff
./myprog -r
echo
;;
stop)
cd /opt/mystuff
./myprog -x
;;
restart)
cd /opt/mystuff
./myprog -x …Run Code Online (Sandbox Code Playgroud)