I've made my own program in C who run like a charm. But I want to launch it systemctl.
Here's my systemd file :
Code: Select all
[Unit]
Description=SensIndoor Logger
After=network.target
[Service]
Type=forking
PrivateTmp=yes
User=root
Group=root
# Run ExecStartPre with root-permissions
PermissionsStartOnly=true
ExecStartPre=-/bin/mkdir /var/run/SensIndoor
ExecStartPre=/bin/chown -R root:root /var/run/SensIndoor
ExecStart=/usr/local/bin/SensIndoor_Logger %I
PIDFile=/var/run/SensIndoor/SensIndoor.pid
[Install]
WantedBy=default.target
Code: Select all
root@raspberrypi:~# systemctl status SensIndoor@ttyACM0.service
● SensIndoor@ttyACM0.service - SensIndoor Logger
Loaded: loaded (/etc/systemd/system/SensIndoor@.service; enabled)
Active: failed (Result: signal) since Wed 2016-11-30 10:36:51 UTC; 37s ago
Process: 1930 ExecStart=/usr/local/bin/SensIndoor_Logger %I (code=killed, signal=SEGV)
Process: 1925 ExecStartPre=/bin/chown -R root:root /var/run/SensIndoor (code=exited, status=0/SUCCESS)
Process: 1922 ExecStartPre=/bin/mkdir /var/run/SensIndoor (code=exited, status=0/SUCCESS)
Nov 30 10:36:45 raspberrypi SensIndoor_Logger[1930]: Starting program with parameter ttyACM0
Nov 30 10:36:45 raspberrypi SensIndoorDaemon[1930]: Daemon starting up
Nov 30 10:36:45 raspberrypi SensIndoorDaemon[1930]: Daemon running
Nov 30 10:36:45 raspberrypi SensIndoor_Logger[1930]: SensIndoorDaemon: Daemon starting up
Nov 30 10:36:45 raspberrypi SensIndoor_Logger[1930]: SensIndoorDaemon: Daemon running
Nov 30 10:36:51 raspberrypi systemd[1]: SensIndoor@ttyACM0.service: control process exited, code=killed status=11
Nov 30 10:36:51 raspberrypi systemd[1]: Failed to start SensIndoor Logger.
Nov 30 10:36:51 raspberrypi systemd[1]: Unit SensIndoor@ttyACM0.service entered failed state.
Neo