/etc/systemd/system/pyfilebrowser.service
Contents
[Unit]
Description=PyFilebrowser Service
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/vicky/pyfilebrowser
ExecStart=/home/vicky/pyfilebrowser/venv/bin/python /home/vicky/pyfilebrowser/temp.py
User=vicky
Group=vicky
Environment="PATH=/home/vicky/pyfilebrowser/venv/bin:$PATH"
StandardOutput=append:/var/log/pyfilebrowser/output.log
StandardError=append:/var/log/pyfilebrowser/error.log
[Install]
WantedBy=multi-user.target
User
andGroup
are not required if the permissions to the files are changed towww-data
Since that involves changing permissions even for modules withinvenv
, it is simpler to run as user
sudo systemctl enable pyfilebrowser.service
sudo systemctl daemon-reload
sudo systemctl start pyfilebrowser.service
[OR]
sudo service pyfilebrowser start
sudo systemctl status pyfilebrowser.service
[OR]
sudo service pyfilebrowser status
sudo systemctl stop pyfilebrowser.service
[OR]
sudo service pyfilebrowser stop
journalctl -u pyfilebrowser.service