I created an application that I want to start on boot for the raspberry.
I had already set up a service for wvdial by hand to make it start on boot and it works like a charm so I then started working on this application of mine. It's no fancy stuff, it's a "simple" service with a command to start, I defined the working directory and the user that will run it.
[Unit]
Description=Blah Blah
[Service]
Type=simple
WorkingDirectory=/home/pi/appdir
ExecStart=/home/pi/appdir/the-script-to-start.py
Restart=always
RestartSec=60
User=pi
When booting, it's not started (systemd says it's inactive (dead)). No output about it on journalctl. If I then try starting by hand with systemctl, it works.
What am I missing?
PS1
Ok.... I think python (or the basic set up to get it working) is not to blame. I switched to configuring a very simple bash script that just prints a line and nothing else... so it goes out with exit code 0.
After rebooting:
● my-service.service - some Service
Loaded: loaded (/etc/systemd/system/my-service.service; static; vendor preset: enabled)
Active: inactive (dead)
When I run it manually:
● my-service.service - some Service
Loaded: loaded (/etc/systemd/system/my-service.service; static; vendor preset: enabled)
Active: activating (auto-restart) since Wed 2018-04-11 16:00:55 UTC; 2s ago
Process: 744 ExecStart=/home/pi/blahblah/prueba.sh (code=exited, status=0/SUCCESS)
Main PID: 744 (code=exited, status=0/SUCCESS)
Is there something I can do in systemd configuration so that I can see more debugging information about how it's working on boot?
PS2
After modifying LogLevel to debug and reboot, I can see that for wvdial, we have this info from journalctl about 22 seconds into boot process (for starters, there's more stuff ):
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: Trying to enqueue job wvdial.service/start/replace
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: Installed new job wvdial.service/start as 182
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: Enqueued job wvdial.service/start as 182
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: Passing 0 fds to service
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: About to execute: /usr/bin/wvdial
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: Forked /usr/bin/wvdial as 498
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: Changed dead -> running
Apr 11 16:53:06 raspberrypi systemd[1]: wvdial.service: Job wvdial.service/start finished, result=done
Apr 11 16:53:06 raspberrypi systemd[1]: Started wvdial service.
Apr 11 16:53:06 raspberrypi systemd[498]: wvdial.service: Executing: /usr/bin/wvdial
But no word about my service.