I have written a systemd service.
When I run
systemctl start foo.service, the service starts and runs correctly, but
systemctl does not return immediately to the shell.
After a while it exits with
Job for foo.service failed because a timeout was exceeded.
and then the service is no longer running.
Here is foo.service, I RTFM and used
Type=forking with a command which forks:
[Unit] Description=blah blah [Service] Type=forking PIDFile=/var/run/myservice.pid ExecStart=/my/path/fork my-script my-args [Install] WantedBy=multi-user.target
my-script does not itself fork, so
/my/path/fork is as follows
#!/bin/bash PATH="$PATH:/my/path" "$@" &
Why does this service not fork and run in the background as expected? I have done everything as root on CentOS.