For the life of me, I cannot get this to work. I'm running Debian on Raspberry Pi.

running this command from CLI:

/home/pi/domotiga/DomotiGaServer.gambas -d

runs my home automation server.

How do I go about running this on boot?

I have a file in my /etc/init.d dir that does get loaded, but it doesn't launch the server

file contents:

# Provides:          domotigaserver
# Required-Start:    $syslog $mysql
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: domotiga server
# Description:

# /etc/init.d/domotigaserver

# Carry out specific functions when asked to by the system
case "$1" in
su pi -c '/home/pi/domotiga/DomotiGaServer.gambas -d'
echo "Starting DomotiGa Server " 
pkill DomotiGaServer.gambas
echo "DomotiGa Server has been stopped (didn't double check though)" 
echo "Usage: /etc/init.d/domotigaserver {start|stop}" 
exit 1

exit 0
  • 8
    Writing the init.d script is not enough, you need to create start/stop links in /etc/rc[0-9].d for the proper run level. Tools like rcconf or update-rc.d can do this for you. See e.g. debianadmin.com/manage-linux-init-or-startup-scripts.html – jofel Dec 30 '12 at 17:46
  • @jofel A verbose version of that comment would make an excellent answer. – user13742 Dec 30 '12 at 19:20
  • 1
    rcconf reports that the domotigaserver is scheduled to load - is that enough? When watching the startup text, 'domotigaserver started' is also listed, yet the server isn't running. Thanks. – Mike Thrussell Dec 30 '12 at 19:42
  • 1
    @MikeThrussell If you see the message, your script seems to be called. Does the program start if you call your script by hand? – jofel Dec 30 '12 at 20:13
  • @jofel yes, it starts when called by hand - I log in (ssh) as user 'pi' to do this – Mike Thrussell Dec 30 '12 at 20:29

Creating init.d scripts is not enough. You need to create start/stop links in /etc/rc[0-9].d for the proper run level.

By default, Debian uses run level 2 (configurable in /etc/inittab).

To create appropriate links, you can use update-rc.d. Run

update-rc.d domotigaserver defaults

as root user.

Alternatively, you can use rcconf (install it e.g. by apt-get install rcconf). It offers a nice TUI.

See for example here for more information.

  • Thanks for your detailed answer. Unfortunately this doesn't seem to be my problem. Running '/etc/init.d/domotigaserver start' by hand also starts the server ok, and rcconf reports it is set to run on startup and the script executes, but the server isn't loaded. – Mike Thrussell Dec 31 '12 at 0:59

Turns out the script was executing too early; before some prerequisites. Symlinks were named S03domotigaserver - I renamed them to S80domotigaserver and it now works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.