How to auto-start extra clients at computer reboot
If you wish to have one or several of the extra client instances started automatically when the computer boots, you can rather trivially add it as a system service (...on Linux).
Here is something which I once used on Debian 9:
Bash:
sudo dd of=/lib/systemd/system/boinc-client_40000.service << EOF
[Unit]
Description=Berkeley Open Infrastructure Network Computing Client 40000
After=network.target
[Service]
Nice=10
User=boinc
PermissionsStartOnly=yes
ExecStartPre=/usr/bin/touch /var/log/boinc_40000.log /var/log/boincerr_40000.log
ExecStartPre=/bin/chown boinc:boinc /var/log/boinc_40000.log /var/log/boincerr_40000.log
ExecStart=/bin/sh -c '/usr/bin/boinc --gui_rpc_port 40000 --dir /var/lib/boinc-client_40000 >/var/log/boinc_40000.log 2>/var/log/boincerr_40000.log'
ExecReload=/usr/bin/boinccmd --host localhost:40000 --read_cc_config
ExecStopPost=/bin/rm -f /var/lib/boinc-client_40000/lockfile
IOSchedulingClass=idle
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable boinc-client_40000
sudo service boinc-client_40000 start
In this example, the data directory was called /var/lib/boinc-client_40000, and the directory and all its contents were owned by the pseudo-user boinc.
I came up with the systemd unit file by looking at the existing /lib/systemd/system/boinc-client.service. Monkey see, monkey do.
Note, a more proper place for the systemd unit file would probably have been /etc/systemd/system/. It's a local customization after all, not a packaged service file.
Note to self, to be done:
- Verify how the unit file should look like on current popular distributions, e.g. Mint 20.
- Demonstrate how to use one single template unit file for arbitrary many instances.
Documentation: man systemd.unit, man systemd.service, man systemd.exec.