includes systemd service setup
This commit is contained in:
parent
6a4654a278
commit
d65a79adb1
4 changed files with 36 additions and 9 deletions
13
app-timer.service
Normal file
13
app-timer.service
Normal 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
|
||||
11
config.yaml
11
config.yaml
|
|
@ -5,12 +5,19 @@ timers:
|
|||
- retroarch
|
||||
- minecraft
|
||||
# how many minutes of usage
|
||||
time-limit: 60
|
||||
time-limit: 40
|
||||
# within how many hours of interval
|
||||
limit-interval: 12
|
||||
websurf:
|
||||
apps:
|
||||
- chrome
|
||||
- chromium
|
||||
- firefox
|
||||
time-limit: 90
|
||||
limit-interval: 24
|
||||
pomodoro:
|
||||
apps:
|
||||
- atom
|
||||
- sublime_text
|
||||
time-limit: 30
|
||||
limit-interval: 45
|
||||
limit-interval: 0.7
|
||||
|
|
|
|||
19
readme.md
19
readme.md
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
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
|
||||
|
||||
|
|
@ -30,8 +30,15 @@ timers:
|
|||
There's a systemd service file ready for use.
|
||||
|
||||
```bash
|
||||
cp ./timer.service /etc/systemd/system/app-timer.service
|
||||
systemctl enable app-timer
|
||||
# download the sources
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
yaml
|
||||
pyyaml
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue