我试图用debian在BBG中安装NoIP。它工作正常,但我手动启动服务:
sudo /usr/local/bin/noip2
我试着把它放在启动时。我找到了这个配置但没有用。
sudo cp debian.noip2.sh /etc/init.d/
sudo chmod +x /etc/init.d/debian.noip2.sh
sudo ln -s /etc/init.d/debian.noip2.sh /etc/rc2.d/S20noip
如何在启动时输入此命令:
sudo /usr/local/bin/noip2
内部debian.noip2.sh
DAEMON=/usr/local/bin/noip2
NAME=noip2
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting dynamic address update: "
start-stop-daemon --start --exec $DAEMON
echo "noip2."
;;
stop)
echo -n "Shutting down dynamic address update:"
start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
echo "noip2."
;;
restart)
echo -n "Restarting dynamic address update: "
start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
start-stop-daemon --start --exec $DAEMON
echo "noip2."
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
答案 0 :(得分:0)
谢谢tripleee。我用这个脚本使用systemd解决了这个问题。
[Unit]
Description= NoIp
After=multi-user.target
[Service]
Type=forking
ExecStart=/usr/local/bin/noip2
[Install]
WantedBy=multi-user.target