-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add systemd service #23
Conversation
Thank you for your suggestion, doesn't ActivityWatch manage the modules and run the modules itself? I have added a similar functionality myself to the bundled version which works almost identically to the original distribution of ActivityWatch (particularly, Qt-based tray icon app). Or is it about the delays? If some environment requires a timeout, I think it may be considered in the code to facilitate the usage for everyone, for example, I added delays and more attempts for #8 and #11 |
You're welcome. Indeed, this is a suggestion. I use it. ActivityWatch manages its modules, if you run them through aw-qt. It also has a systemd service at https://github.com/ActivityWatch/aw-server-rust/blob/82345cfc5371c673a9bc2b5284530ae8c180153d/aw-server.service that lets you start aw-server, but then its modules don't start. The issue with delay is so that if aw-server doesn't initialize fully then aw-awatcher goes dead, but systemd doesn't know that. If you can fix that somehow (either by failing aw-awatcher or idling for aw-server) then it would be even a better solution. BTW, I believe the issues you pointed doesn't help me. I don't use bundled version and I use you latest watcher and still have to be careful when to start your watcher. |
There are 3 reconnection attempts with 1 second interval, doesn't this work for you? Maybe, 3 attempts/2 seconds waiting is not enough?
Doesn't aw-awatcher fail the way which is recognized by systemd? |
Certainly not on my old machine. It's far too less. I also have a newer and quite fast machine, but I wouldn't bet that 3 times 1 s is enough for it 🙂
I'm not an expert on this but replacing the delay with
under the service tag doesn't help, so I concluded that it doesn't actually report failing. Maybe the return code is still zero. |
Just checked, the return code is ok if you have this error:
|
Yes, maybe I should experiment a bit more with this. Thanks for the error codes listing. I'm surprised that an error code could be 0. Shouldn't that be reserved for "everything's ok"? |
I'm not sure I understand, the error code for awatcher is 1 when the aforementioned exception happens as |
Ok, I did no try it yet, so maybe I don't quite understand what "0: error sending request for url [...]" means. |
Here's what I'm using:
and
Not sure, but maybe setting Nice would be something to consider? |
Thanks for sharing, but I'm not sure "nice" is a robust solution here. Now I'm just leaning more toward that this should be fixed on ActivityWatch side through something called forking as seen at Then here the systemd service could be minimal. |
I used sd-notify in aw-server-rust to inform systemd exactly when the server is up and running and only then start awatcher, but that didn't help during boot, so it's not about non-existent communication with aw-server-rust. What I found is that without The new version of the service should be robust on every system. It sleeps for 5 seconds after aw-server.service or graphical-session.target (that's where kwin_x11 starts) starts. If it will not find KDE or GNOME, it'll exit successfully, but will try to restart itself after 5 s then after 10 s and then after every 15 s and will finally give up after 2 minutes. Could you accept that PR? |
Thank you for your updated config. It looks more robust and shareable, but it requires |
No description provided.