includes systemd service setup

This commit is contained in:
Thiago Macedo 2019-03-13 10:00:57 -03:00
parent 6a4654a278
commit d65a79adb1
4 changed files with 36 additions and 9 deletions

13
app-timer.service Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=App Timer Service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/env python3 /opt/app-timer/timer.py
[Install]
WantedBy=multi-user.target

View file

@ -5,12 +5,19 @@ timers:
- retroarch - retroarch
- minecraft - minecraft
# how many minutes of usage # how many minutes of usage
time-limit: 60 time-limit: 40
# within how many hours of interval # within how many hours of interval
limit-interval: 12 limit-interval: 12
websurf:
apps:
- chrome
- chromium
- firefox
time-limit: 90
limit-interval: 24
pomodoro: pomodoro:
apps: apps:
- atom - atom
- sublime_text - sublime_text
time-limit: 30 time-limit: 30
limit-interval: 45 limit-interval: 0.7

View file

@ -2,9 +2,9 @@
Control apps usage time with a command line application. Control apps usage time with a command line application.
The python daemon will watch for the apps runtime (with `ps`) and store timing information about it's usage. It can block (`kill`) an app if the usage is off limits. The python daemon will watch for the apps executable and store usage time for them. It can block an app if the usage is off limits.
I'm using this at a raspberry pi gaming station to enforce usage limits. I'm using this at a raspberry pi gaming station (retropie) to enforce usage limits. Other use cases are very plausible, like any other gaming platform or even enforcing a pomodoro timer for your coding time. Be creative and let me know.
## Config ## Config
@ -30,8 +30,15 @@ timers:
There's a systemd service file ready for use. There's a systemd service file ready for use.
```bash ```bash
cp ./timer.service /etc/systemd/system/app-timer.service # download the sources
systemctl enable app-timer cd /opt/
git clone https://github.com/thiagof/app-timer
cd app-timer
# yaml dependency
sudo -H pip3 install -r requirements.txt
# setup the daemon
sudo cp ./app-timer.service /etc/systemd/system/app-timer.service
sudo systemctl enable app-timer
# check the service
sudo systemctl status app-timer
``` ```
Update this file to point `ExecStart` into your setup folder.

View file

@ -1 +1 @@
yaml pyyaml