systemd service
テンプレート(一般ユーザ権限、bashrc使用)
[Unit]Description=My Service[Service]Type=simpleUser=userGroup=userRestart=alwaysWorkingDirectory=WORKING_DIRExecStart=/bin/bash -c "COMMAND"[Install]WantedBy=multi-user.target
sudo ln -s my_service.service /etc/systemd/system/sudo systemctl enable my_servicesudo systemctl restart my_service# After you edit service filesudo systemctl daemon-reload# Check logsudo systemctl status my_service
If you are using python, maybe you need to set environment PYTHONUNBUFFERED=1
to see log.
# In [Service] SectionEnvironment="PYTHONUNBUFFERED=1"Environment="KEY=VALUE"