Zum Inhalt der Seite gehen


Als Antwort auf Michael Vogel

@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.
Als Antwort auf Tealk

@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
Als Antwort auf utzer [Friendica]

@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.
Als Antwort auf utzer [Friendica]

@utzer do you have the same path for the pid in systemd and in the friendica config?
Als Antwort auf Tealk

@Tealk yes. Now I wonder if the systemd PIDFile setting is to check for the PID file or to create one?!
Als Antwort auf Tealk

@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.
Als Antwort auf utzer [Friendica]

@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
Als Antwort auf Tealk

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).
Dieser Beitrag wurde bearbeitet. (2 Jahre her)
Als Antwort auf elrido

@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!