chs5056
Posts: 2
Joined: Sat Jan 04, 2020 1:04 am

Program Crashes on Systemd (systemctl), Works Fine Running Manually

Sat Jan 04, 2020 1:11 am

I have a program that uses sockets to connect to a server, retrieve data (on an interval) and (based on that data) power an LED matrix.

When I run this program manually, it works completely fine, for however long I run it for. However, when I setup systemd to run the program, it crashes about every 1-2 minutes (It does restart the program again correctly, but I want to figure out why it's crashing)

Here is the systemd config:

Code: Select all

[Unit]
Description=Autossh keepalive daemon
## make sure we only start the service after network is up
Wants=network-online.target
After=network.target

[Service]
## use 'Type=forking' if the service backgrounds itself
## other values are Type=simple (default) and Type=oneshot
Type=forking
## here we can set custom environment variables
ExecStart=/home/pi/nbaboard.sh
#ExecStop=/usr/bin/killall -9 autossh
### NOTE: you can have multiple `ExecStop` lines
#ExecStop=/usr/bin/killall ssh
# don't use 'nobody' if your script needs to access user files
# (if User is not set the service will run as root)
#User=nobody
Restart=always
RestartSec=3

# Useful during debugging; remove it once the service is working
#StandardOutput=console

[Install]
WantedBy=multi-user.target

Any idea what I'm doing wrong? Or any ideas to help me troubleshoot (how/where to create logs, etc.)? (Let me know if I should share code samples for the program. It just uses basic sockets and a c program based on this repo: https://github.com/hzeller/rpi-rgb-led-matrix)

Thanks,
Chris

Return to “Troubleshooting”