80.3 CSS System Management


We will set up a public solid server to save data in /opt/solid/server and to place a log file into /opt/solid/log both which we first need to create. Be sure you are logged into the solid user account.

sudo -su solid
mkdir /opt/solid/server /opt/solid/log

Start the Solid server (changing example.org to your domain) and visit your domain:

community-solid-server --baseUrl https://solid.example.org \
                       --port 3000 \
                       --config @css:config/file.json \
                       --rootFilePath /opt/solid/server/

We can create a shell script /opt/solid/manage_solid_server.sh to handle the server management.

emacs /opt/solid/manage_solid_server.sh

The contents should be as below, changing example.com to your own domain name.

#!/usr/bin/env bash

URL="https://solid.example.com/" # EDIT ME!

export NVM_DIR="${BASE}/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

case "${1}" in
        if pgrep -f community-solid-server; then
            echo "Server is already running.";
        else community-solid-server --baseUrl ${URL} --port ${PORT} \
                                    --config @css:config/file.json \
                                    --rootFilePath ${DATA} >> ${LOG} 2>&1 & disown;
             pgrep -f community-solid-server; fi;;
        if pgrep -f community-solid-server; then
            echo "Server is running.";
        else echo "Server is not running"; fi;;
        cat ${LOG};;
        if pgrep -f community-solid-server; then
            pgrep -f community-solid-server | xargs kill
        else echo "Server is not running"; fi;;
        echo "Supported commands: start, stop, status, log.";;

Make the script executable:

chmod a+x /opt/solid/manage_solid_server.sh

See Section 80.4 to utilise the script and to configure systemd to start the server on boot.

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