This package provides a simple means for controling Systemd services remotely.
It uses NiceGUI to run a simple web page with Enable/Disable, Start/Stop, and system reboot options.
These instructions assume starting with a fresh install of Raspberry Pi OS Lite (Bookworm).
-
Install OS packages:
sudo apt update sudo apt upgrade sudo apt install python3-pip python3-venv python3-setuptools git libsystemd-dev python3-pystemd sudo reboot now
-
Create a Python virtual environment
python -m venv service_control_env
-
Install Python packages into the virtual environment
source service_control_env/bin/activate pip install nicegui pystemd
-
Clone the project
Create a new SSH key for the system and add it to GitHub.
ssh-keygen -t ed25519 -C "your_email@example.com"
Setup Git.
git config --global user.name "Mona Lisa" git config --global user.email "YOUR_EMAIL"
Clone to project.
git clone git@github.com:mptsolutions/service_control.git
- Rename
config_template.py
toconfig.py
and update with correct values.
source /home/pi/service_control_env/bin/activate
sudo /home/pi/service_control_env/bin/python /home/pi/service_control/main.py
- Copy
service_control.service
to/lib/systemd/system/
. - Run
sudo systemctl daemon-reload
- Run
sudo systemctl enable service_control.service
This will allow remote access to the pi
user directory for easier file editing.
-
Install Samba
sudo apt install samba samba-common-bin
-
Edit the
smb.conf
sudo nano /etc/samba/smb.conf
Update the workgroup line:
workgroup = [HOME WORKGROUP NAME]
Make home directories accessible:
[homes] comment = Home Directories browseable = yes # By default, the home directories are exported read-only. Change the # next parameter to 'no' if you want to be able to write to them. read only = no
Add a share for the
pi
user home directory:[f1_buzzer] path = /home/pi writeable=yes browseable=yes public=yes