Republished on my website, keeping this version here for historical reasons.
Install FAHClient as documented in the official guide. Stop the traditional init script service that was created and automatically started.
$ sudo /etc/init.d/FAHClient stopMove the init script to another location. Path /usr/local/bin can be changed,
but be sure to use the correct path in the service unit file of the next step.
$ sudo mv /etc/init.d/FAHClient /usr/local/binCopy the contents of the gist Systemd service unit for Folding@Home
Client into (a new)
file /etc/systemd/system/fahclient.service. File contents included here:
[Unit]
Description=Folding@Home V7 Client
Documentation=https://folding.stanford.edu/home/the-software/
[Service]
Type=simple
PIDFile=/var/run/fahclient.pid
ExecStart=/usr/local/bin/FAHClient -v start
ExecReload=/usr/local/bin/FAHClient -v restart
ExecStop=/usr/local/bin/FAHClient -v stop
KillMode=process
[Install]
WantedBy=multi-user.targetThen update its ownership and permissions as below
$ sudo chown root:root /etc/systemd/system/fahclient.service
$ sudo chmod u=rw,go=r /etc/systemd/system/fahclient.serviceThe systemd service unit for FAHClient is installed. Reload systemd manager configuration
$ sudo systemctl daemon-reloadQuery the status of service unit.
$ sudo systemctl status --full fahclient.serviceStart and stop as a regular systemd service
$ sudo systemctl stop fahclient.service
$ sudo systemctl start fahclient.serviceFolding@home is a distributed computing project for disease research that simulates protein folding, computational drug design, and other types of molecular dynamics. See also the Volunteer Computing page.
That's because with your configuration you start fahclient as root user (which is not really good from my point of view). It is only when you start fahclient with run-as option that you actually use fahclient user. Everything else will be perform with root user. If you set user to be fahclient in you service file, you can use WorkingDirectory option and get rid of the chdir option while starting your daemon. Note that you'll also need the RuntimeDirectory option as fahclient user won't have permission to create his pid file without it. I just added it to the service file I wrote here and it is working like a charm: FoldingAtHome/fah-issues#1396
I'll just put it here too: