leah@asus-zenbook ~> cat .config/systemd/user/mytest.service
[Unit]
Description=Test python service
[Service]
Type=simple
ExecStart=/usr/bin/python /home/leah/mytest.py
Restart=on-failure
[Install]
WantedBy=default.target
leah@asus-zenbook ~> cat mytest.py
from datetime import datetime
from time import sleep
while(True):
print("Hello, time is {time:%Y-%m-%d %H:%M:%S}".format(time=datetime.now()))
sleep(10)
leah@asus-zenbook ~> systemctl --user enable mytest
leah@asus-zenbook ~> systemctl --user start mytest
leah@asus-zenbook ~> systemctl --user status mytest
● mytest.service - Test python service
Loaded: loaded (/home/leah/.config/systemd/user/mytest.service; enabled; preset: enabled)
Active: active (running) since Sun 2023-02-19 12:39:58 MSK; 1min 24s ago
Main PID: 1001 (python)
Tasks: 1 (limit: 9337)
Memory: 8.1M
CPU: 20ms
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/mytest.service
└─1001 /usr/bin/python /home/leah/mytest.py
Feb 19 12:39:58 asus-zenbook systemd[987]: Started Test python service.
leah@asus-zenbook ~>
mssfix
hand-window 300
.config/autoload
.config/autoload