80.4 CSS Systemd Integration

20220605

In Section 80.3 we set up a command script to manage the solid server. We can put in place a convenient command to manage the solid server as /usr/local/bin/solid:

sudo emacs /usr/local/bin/solid
#!/usr/bin/env bash
/usr/bin/sudo -u solid /opt/solid/manage_solid_server.sh "${1}"
sudo chmod a+x /usr/local/bin/solid

Any user with sudo rights can then run the following commands:

solid start   # Start the community solid server
solid status  # Show status of community solid server
solid log     # Show the log from the community solid server
solid stop    # Stop the community solid server

To start the solid server on boot create the systemb unit file for the solid service:

sudo emacs /etc/systemd/system/solid.service

Its contents is below, noting to start solid after caddy is running.

# solid.service
#
# Community Solid Server

[Unit]
Description=Solid community server
Documentation=https://github.com/CommunitySolidServer/CommunitySolidServer/
After=network.target caddy.service

[Service]
Type=simple
User=solid
ExecStart=/opt/solid/manage_solid_server.sh start
ExecStop=/opt/solid/manage_solid_server.sh stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then reload the systemd daemon and start the solid server:

sudo systemctl daemon-reload
sudo systemctl enable solid
systemctl is-active solid
sudo systemctl start solid

The solid server will now automatically start on a reboot.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0