Skip to main content


AFAIK @utzer is doing so.
@Michael Vogel @Tealk only the deamon, since you told me that is better.

But yes, I have it running with systemd and it works fine.
@utzer how does your .service file look like?
@Tealk I was just looking for it, here it is:

.service:
[Unit]
Description=Friendica worker daemon
After=network.target
After=mariadb.service

[Service]
User=www-data #same user as the webserver runs with
Type=forking
ExecStart=/web/base/path/bin/daemon.php start
ExecStop=/web/base/path/daemon.php stop
TimeoutSec=60
Restart=always
RestartSec=60
PIDFile=/tmp/friendica_daemon.pid

[Install]
WantedBy=multi-user.target
@Tealk the daemon will run continously anyway... it works like this, don't ask me how I came up with this, it was a long time ago.
@utzer do you have the same path for the pid in systemd and in the friendica config?
@Tealk yes. Now I wonder if the systemd PIDFile setting is to check for the PID file or to create one?!
@utzer actually the daemon.php and the systemd should create a pid file
@Tealk I guess daemon.php is executable ? But I also think it does not matter if you use the full php path.

So you say there should be one PID for each of them? Hmm but it works like this, I guess systemd just checks if there is a PID file and gives a fault if there is? Not sure.
@utzer I just thought you had to specify ExecStart/Stop to run with php as well. How else does Systemd know how to run it?

I have always understood PIDFile so that systemd creates a file, maybe it does not bother in this case because the daemon also just enters the pid
I just thought you had to specify ExecStart/Stop to run with php as well. How else does Systemd know how to run it?

The script starts with a shebang: https://github.com/friendica/friendica/blob/develop/bin/daemon.php#L1

If it is executable, the kernel will parse that first line and if it starts with shebang it will instead call that binary and pass the script path to it as an argument. So it will really execute "/usr/bin/env php <path to your daemon.php script>" (and env will just resolve the path of the php binary and call that with all arguments - it's needed because not all UNICES have their binaries in the same paths).
This entry was edited (3 months ago)
@elrido @Tealk cool, I learned two things, first what a bang is... like in !Friendica Support, it is a !-bang mention.

And I learned how that thing is called in the first line of a normal shell script, it is a shell bang. :-D

Thanks!