我已经安装了Debian的最新稳定版本(杰西),但/etc/inittab不存在。我读过新的init系统叫做Sysv。我需要启动一个带参数的服务,我过去常常在inittab中添加一行,如u1:23:respawn:/etc/init.d/my_service foreground
我正在尝试用sysvrc-conf -p添加这个,但我不知道如何...
没有inittab我该怎么做呢?非常感谢。
发布于 2016-06-11 15:53:44
通过google发现了这个问题,也许其他人发现了这个有用的东西: Debian Jessie的新初始化系统是systemd。Debian Wheezy中的老方法是使用/etc/inittab的Sysv。
要使用systemd创建重新生成服务,只需在/etc/systemd/system/中创建一个文件,即mplayer2.service
[Unit]
Desription=mplayer with systemd, respawn
After=network.target
[Service]
ExecStart=/usr/bin/mplayer -nolirc -ao alsa -vo null -really-quiet http://stream.sunshine-live.de/hq/mp3-128/Facebook-og-audio-tag/
Restart=always
[Install]
WantedBy=multi-user.target并激活它
systemctl enable mplayer2.service重新启动或手动启动
systemctl daemon-reload
systemctl start mplayer2.service如果您重新启动或终止该进程,它将在几秒钟后自动重新启动。
https://stackoverflow.com/questions/30436837
复制相似问题