I am connecting from my BeagleBone running Debian to a cellular modem.
In order to connect, I enter command pppd file /etc/ppp/peers/zdial &
Now, in order to execute this command on boot-up, I created a script start-ppp.sh which runs this command as below.
I then create and enable a service ppp-connect.service as below. sudo systemctl enable ppp-connect.
I would expect this service to run on boot-up and automatically connect to my modem but it doesn't work.
However, If I manually start the service with sudo systemctl start ppp-connect , then my service starts and I can connect to the modem.
Why is it that it does not connect on boot-up automatically? Can anyone see something obvious that I am doing wrong. Perhaps it's something to do with not entering the password for sudo during boot-up. I'm not sure.
start-ppp.sh
#!/bin/sh -e
sudo -H -u debian pppd file /etc/ppp/ppers/zdial &
ppp-connect.service
[Unit]
Description=ppp_service
ConditionPathExists=/dev/ttyACM0
[Service]
Type=forking
ExecStart=/bin/sh /home/debian/start-ppp.sh
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target
User=debian
in the[Service]
section. Presumably the script is executable by that user, so there's also no need to use/bin/sh
to call it. Beyond that, all the script is doing is executingppd
, so why not just make that the ExecStart?journalctl -u ppp_service
?systemctl status ppp-connect.service
after boot, that should help us diagnose the problem. And also, as @JeffSchaller pointed out, please look atjournalctl -u ppp-connect.service
(he usedppp_service
which is incorrect, the argument should match the filename, not theDescription=
...)After=dev-ttyACM0.device
to the[Unit]
stanza, since it's possible your service is being run before that device is up and that's causing it to fail (due to theConditionPathExists=
constraint.)