Bonjour,
Je suis en train de me faire une configuration Syncthing pour synchroniser différentes machines et envoyer des backups chez mes parents. 
J’ai suivi ce tutoriel sur techdelirium pour installer Syncthing sur une Raspberry Pi. Tout fonctionne parfaitement. J’essaye maintenant de reproduire le tout sur ma Debian 8 et le script d’init me pose des soucis.
Il ne fonctionnait pas avec l’utilisateur courant (contrairement au script sur la Raspberry Pi).
Le script :
[code]simon@debian8:~$ cat /etc/init.d/syncthing
#!/bin/sh
BEGIN INIT INFO
Provides: syncthing
Required-Start: $local_fs $remote_fs
Required-Stop: $local_fs $remote_fs
Should-Start: $network
Should-Stop: $network
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: Multi-user daemonized version of syncthing.
Description: Starts the syncthing daemon for all registered users.
END INIT INFO
Replace with users you want to run syncthing clients for
syncthing_USERS=“simon” #Remplacer par l’utilisateur qui lance syncthing
DAEMON=/home/simon/syncthing-linux-amd64-v0.10.30/syncthing #Remplacer cette ligne par le bon chemin vers syncthing
startd() {
for stuser in $syncthing_USERS; do
HOMEDIR=$(getent passwd $stuser | awk -F: ‘{print $6}’)
if [ -f $config ]; then
echo "Starting syncthing for $stuser"
start-stop-daemon -b -o -c $stuser -S -u $stuser -x $DAEMON
else
echo "Couldn’t start syncthing for $stuser (no $config found)"
fi
done
}
stopd() {
for stuser in $syncthing_USERS; do
dbpid=$(pgrep -fu $stuser $DAEMON)
if [ ! -z “$dbpid” ]; then
echo "Stopping syncthing for $stuser"
start-stop-daemon -o -c $stuser -K -u $stuser -x $DAEMON
fi
done
}
status() {
for stuser in $syncthing_USERS; do
dbpid=$(pgrep -fu $stuser $DAEMON)
if [ -z “$dbpid” ]; then
echo "syncthing for USER $stuser: not running."
else
echo "syncthing for USER $stuser: running (pid $dbpid)"
fi
done
}
case “$1” in
start) startd
;;
stop) stopd
;;
restart|reload|force-reload) stopd && startd
;;
status) status
;;
*) echo "Usage: /etc/init.d/syncthing {start|stop|reload|force-reload|restart|status}"
exit 1
;;
esac
exit 0[/code]
Quand j’essaye de le lancer :
simon@debian8:~$ /etc/init.d/syncthing start
Starting syncthing for simon
/etc/init.d/syncthing: 23: /etc/init.d/syncthing: start-stop-daemon: not found
J’ai résolu le problème avec un
Mais est-ce que ça ne risque pas de poser des problèmes de sécurité ?
Merci d’avance,
