自动启动 Activitywatch - 16.04

自动启动 Activitywatch - 16.04

我试图自动启动 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.

答案1

aw-qt可以通过添加启动应用程序手动完成。

aw-qt 可执行文件

参考:ActivityWatch / activitywatch 文档如何在所有平台上自动启动 #116

相关内容