4

I've installed the last stable version of Debian (Jessie) and /etc/inittab doesn't exist. I have read the new init system is called Sysv. I need to launch a service with parameter, I used to add a line in inittab like u1:23:respawn:/etc/init.d/my_service foreground

I'm trying to add this one with sysvrc-conf -p but I don't know how...

How can I do that without inittab? Thank you so much.

Mon
  • 131
  • 2
  • 4

1 Answers1

2

Found this question by google, maybe someone else finds this usefull: The new init system for Debian Jessie is systemd. The old way in Debian Wheezy was Sysv with /etc/inittab.

To create a respawn service with systemd just create a file in /etc/systemd/system/ i.e. 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

and activate it

systemctl enable mplayer2.service

reboot or start it manually

systemctl daemon-reload
systemctl start mplayer2.service

If you reboot or kill the process, it will be restarted automatically some seconds later.

admirableadmin
  • 2,669
  • 1
  • 24
  • 41