Linux
系統化的新貴
我得到了一個 systemd 服務,但由於各種原因,我仍在使用 Ubuntu 14.04。你可能知道 ubuntu 使用 upstart 而不是 systemd。你們能幫我把這個 systemd 服務轉換成新貴服務嗎?
[Unit] Description=Conan - dong sliders to MAX After=syslog.target network.target [Service] ExecStart=/home/steam/exiles/start_conan.sh User=steam Type=simple Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target
作為根:
- 將以下文本另存為
/etc/init.d/conan
.- 設置可執行標誌
chmod +x /etc/init.d/conan
。- 嘗試執行它:
/etc/init.d/conan start
- 都好?將其添加到執行級別
update-rc.d conan defaults
#! /bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="conan service" NAME=conan DAEMON=/usr/sbin/$NAME DAEMON_ARGS="--options args" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME . /lib/init/vars.sh . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" export DISPLAY=:0 export WINEARCH=win64 export WINEPREFIX=/home/steam/.wine64 xvfb-run --auto-servernu m--server-args='-screen 0 640x480x24:32' wine /home/steam/exiles/common/Conan/ConanSandboxServer.exe -log -QueryPort=27055 & ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" wineserver -k #wineserver -k9 ;; status) [ $(pgrep -f wine | wc -l) -gt 0 ] && log_daemon_msg "is running" || log_daemon_msg "not running" ;; restart) stop sleep 2 start ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2 exit 3 ;; esac