2017-09-17 6 views
-1

J'essaie de démarrer un service nommé pigpiod.service via systemd. Il appelle un script avec trois commandes. Le second est laissé de côté. Pourquoi est-ce?Le service Systemd abandonne la commande dans le script

/etc/systemd/system/pigpiod.service:

[Unit] 
Description=Starts pigpiod 
Before=touchscreen.service 

[Service] 
ExecStart=/home/sysop/pigpiod.sh 

[Install] 
WantedBy=multi-user.target 

/home/sysop/pigpiod.sh:

#!/bin/sh 

touch /home/sysop/before_pigpiod 
/usr/bin/pigpiod 
touch /home/sysop/after_pigpiod 
  • Lors du redémarrage de la machine les deux fichiers créés dans se /home/sysop/, mais pigpiod ne démarre pas.
  • Lors du démarrage manuel du service via sudo systemctl start pigpiod, la même chose se produit.
  • Lors de l'exécution sudo /home/sysop/pigpiod.sh manuellement pigpiod commence réellement!

Ceci est la sortie de sudo systemctl status pigpiod -l droite après le démarrage:

● pigpiod.service - Starts pigpiod 
    Loaded: loaded (/etc/systemd/system/pigpiod.service; enabled) 
    Active: inactive (dead) since Sat 2017-09-16 20:02:03 UTC; 2min 29s ago 
    Process: 440 ExecStart=/home/sysop/pigpiod.sh (code=exited, status=0/SUCCESS) 
Main PID: 440 (code=exited, status=0/SUCCESS) 

Sep 16 20:02:02 kivypie systemd[1]: Starting Starts pigpiod... 
Sep 16 20:02:02 kivypie systemd[1]: Started Starts pigpiod. 

Pourquoi est-ce que systemd saute l'exécution de /usr/bin/pigpiod, mais exécutant manuellement le script en tant que root ne fonctionne pas?

Mon système: Raspberry Pi Modèle 3B, Raspbian GNU/Linux 8 (jessie)

+0

Stack Overflow est un site pour les questions de programmation et de développement. Cette question semble être hors sujet car il ne s'agit pas de programmation ou de développement. Voir [Quels sujets puis-je poser à ce sujet?] (Http://stackoverflow.com/help/on-topic) dans le centre d'aide. Peut-être [Super User] (http://superuser.com/) ou [Unix & Linux Stack Exchange] (http://unix.stackexchange.com/) serait un meilleur endroit à demander. – jww

Répondre

-1

pigpiod fourches sans l'option -g. Il faut donc utiliser Type = forking ou utilisez pigpiod -g

[Unit] 
Description=Starts pigpiod 
Before=touchscreen.service 

[Service] 
ExecStart=/home/sysop/pigpiod.sh 
Type=forking 

[Install] 
WantedBy=multi-user.target