我试图自动启动 ActivityWatch。activitywatch.service
在 中创建了一个文件/etc/systemd/system
。
[Unit]
Description=Activity Watch
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/home/anoopd/venv/bin/aw-qt -c "~/.config/activitywatch"
[Install]
WantedBy=multi-user.target
重新加载系统
sudo systemctl --system daemon-reload
要在启动时自动启动:
sudo systemctl enable activitywatch
现在启动:
sudo systemctl start activitywatch
当我检查状态时:
$ sudo systemctl status activitywatch
● activitywatch.service - Activity Watch
Loaded: loaded (/etc/systemd/system/activitywatch.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-09-06 09:13:10 IST; 25min ago
Process: 11013 ExecStart=/home/anoopd/venv/bin/aw-qt -c ~/.config/activitywatch (code=exited, status=2)
Main PID: 11013 (code=exited, status=2)
Sep 06 09:13:08 anoops-ubuntu systemd[1]: Started Activity Watch.
Sep 06 09:13:09 anoops-ubuntu aw-qt[11013]: usage: aw-qt [-h] [--testing] [--autostart-modules AUTOSTART_MODULES]
Sep 06 09:13:09 anoops-ubuntu aw-qt[11013]: aw-qt: error: unrecognized arguments: -c ~/.config/activitywatch
Sep 06 09:13:10 anoops-ubuntu systemd[1]: activitywatch.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 06 09:13:10 anoops-ubuntu systemd[1]: activitywatch.service: Unit entered failed state.
Sep 06 09:13:10 anoops-ubuntu systemd[1]: activitywatch.service: Failed with result 'exit-code'.
我不太清楚INVALIDARGUMENT
。请帮忙。
编辑
我完全删除了该-c
参数ExecStart
,现在状态出现错误:
● activitywatch.service - Activity Watch
Loaded: loaded (/etc/systemd/system/activitywatch.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-09-06 09:54:13 IST; 5s ago
Process: 15036 ExecStart=/home/anoopd/venv/bin/aw-qt (code=exited, status=1/FAILURE)
Main PID: 15036 (code=exited, status=1/FAILURE)
Sep 06 09:54:13 anoops-ubuntu aw-qt[15036]: File "/home/anoopd/venv/lib/python3.5/site-packages/aw_qt/manager.py", line 149, in autostart
Sep 06 09:54:13 anoops-ubuntu aw-qt[15036]: self.start("aw-server")
Sep 06 09:54:13 anoops-ubuntu aw-qt[15036]: File "/home/anoopd/venv/lib/python3.5/site-packages/aw_qt/manager.py", line 142, in start
Sep 06 09:54:13 anoops-ubuntu aw-qt[15036]: self.modules[module_name].start()
Sep 06 09:54:13 anoops-ubuntu aw-qt[15036]: File "/home/anoopd/venv/lib/python3.5/site-packages/aw_qt/manager.py", line 50, in start
Sep 06 09:54:13 anoops-ubuntu aw-qt[15036]: os.setpgrp()
Sep 06 09:54:13 anoops-ubuntu aw-qt[15036]: PermissionError: [Errno 1] Operation not permitted
Sep 06 09:54:13 anoops-ubuntu systemd[1]: activitywatch.service: Main process exited, code=exited, status=1/FAILURE
Sep 06 09:54:13 anoops-ubuntu systemd[1]: activitywatch.service: Unit entered failed state.