[solved] RaspberryPi init.d startup script not working

Hello there,
this might sound like a silly question, but I can’t figure out why my stuff still not working:
I’ve got a rasperrypi typ a and want a program (Syncthing) starting on startup. Therefore I wrote a bash script and moved it in /etc/init.d
My Script looks like this:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          start_Syncthing.sh
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Start syncthing at boot time
# Description:       syncing Fileserver.
### END INIT INFO
 /home/pi/syncthing-linux-arm-v0.14.47/syncthing

I make it executable and then I issued
sudo update-rc.d start_Syncthing.sh defaults
but it refuses to work on boot, even something like
sudo service start_Syncthing.sh start
won’t start a syncthing process.

What I’m doing wrong?
So far I only used the Ubuntu GUI for register a startup command.

You should probably consider using systemd unit files if your distro uses systemd.

I forget if Raspbian does or not. You can test this by typing

systemctl status networking

If it returns status, you’re good. If it gives you a command-not-found, you’re out of luck.

It’s been so long since I’ve worked with upstart… I can’t really help you otherwise.

1 Like

rasbian based on jesse or stretch definitely uses systemd. But there is a legacy rc-local service that is enabled if the file /etc/rc.local has its execute flags set.

You could call your script start_Syncthing.sh from /etc/rc.local.

2 Likes

Okay I managed this, I discovered syncthing has apparently a really good guide (https://docs.syncthing.net/users/autostart.html). And it does indeed place a systemd service in /etc/systemd/system/ . I just had to change the path of binary and activate it.

Thank you guys