Python Script(jm68.py)
/usr/bin/jm68.py
import time
while true:
with open('test.log','a+') as f:
f.write(time.time)
time.sleep(1)
Service Conf(jm68.service)
/lib/systemd/system/jm68.service
[Unit]
Description=QR Code Reader Service
After=multi-user.target
Conflicts=getty@tty1.service
[Service]
Type=simple
ExecStart=/usr/bin/python3 /usr/bin/jm68.py
StandardInput=tty-force
[Install]
WantedBy=multi-user.target
How to use
sudo systemctl daemon-reload
sudo systemctl enable jm68.service
sudo systemctl start jm68.service