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 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: github.com/friendica/friendica…

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. (4 Jahre her)