1

Good morning,

We are trying to start a custom service on a Raspberry PIZero Wireless. The procedure we are using works on a PI3 under Ubuntu 14.04. The PiZero runs 2017-04-10-raspbian-jessie. I'll use the name CUSTOM_SERVICE below.

I tried different things without success. Querying the status of the service reports:

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.

Using the command:

sudo ls -l /etc/systemd/system/multi-user.target.wants/*.service

output:

...
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
...

The service unit file is defined as:

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

where /usr/local/etc/startCustomService is defined as

more /usr/local/etc/startCustomService
#!/bin/sh
/usr/local/sbin/customService

As I said, the service is launched and running correctly under Ubuntu 14.04. Also note that the file /usr/local/etc/startCustomService can be launched manually on PIZero.

Any suggestions?

Regards, Daniel

1 Answers1

0

Try add working directory.

WorkingDirectory=/usr/local/etc/