
Buen día,
Estamos intentando iniciar un servicio personalizado en una Raspberry PIZero Wireless. El procedimiento que estamos utilizando funciona en un PI3 con Ubuntu 14.04. El PiZero se ejecuta 2017-04-10-raspbian-jessie. Usaré el nombre CUSTOM_SERVICE a continuación.
Intenté diferentes cosas sin éxito. Consultar el estado de los informes del servicio:
sudo systemctl status CUSTOM_SERVICE.service
● CUSTOM_SERVICE.service - Custom service
Loaded: loaded (/etc/systemd/system/CUSTOM_SERVICE.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2017-04-26 14:44:40 UTC; 32s ago
Process: 1516 ExecStart=/usr/local/etc/startCustomService (code=exited, status=203/EXEC)
Main PID: 1516 (code=exited, status=203/EXEC)
Apr 26 14:44:40 raspberrypi systemd[1]: CUSTOM_SERVICE.service: main process exited, code=exited, status=203/EXEC
Apr 26 14:44:40 raspberrypi systemd[1]: Unit CUSTOM_SERVICE.service entered failed state.
Usando el comando:
sudo ls -l /etc/systemd/system/multi-user.target.wants/*.service
producción:
...
lrwxrwxrwx 1 root root 40 Apr 10 09:24 /etc/systemd/system/multi-user.target.wants/avahi-daemon.service -> /lib/systemd/system/avahi-daemon.service
lrwxrwxrwx 1 root root 38 Apr 26 13:53 /etc/systemd/system/multi-user.target.wants/CUSTOM_SERVICE.service -> /etc/systemd/system/CUSTOM_SERVICE.service
...
El archivo de la unidad de servicio se define como:
more /etc/systemd/system/multi-user.target.wants/CUSTOM_SERVICE.service
[Unit]
Description=Custom service
After=network-online.target
[Service]
Type=simple
RestartSec=60
Restart=always
ExecStart=/usr/local/etc/startCustomService
[Install]
WantedBy=multi-user.target
dónde/usr/local/etc/startCustomServiceSe define como
more /usr/local/etc/startCustomService
#!/bin/sh
/usr/local/sbin/customService
Como dije, el servicio se inicia y se ejecuta correctamente en Ubuntu 14.04. También tenga en cuenta que el archivo/usr/local/etc/startCustomServicese puede iniciar manualmente en PIZero.
¿Alguna sugerencia?
Saludos, Daniel
Respuesta1
Intente agregar un directorio de trabajo.
WorkingDirectory=/usr/local/etc/