Add systemd timer
This commit is contained in:
parent
054c389892
commit
0cca19d948
3 changed files with 29 additions and 0 deletions
11
README.md
11
README.md
|
@ -18,6 +18,17 @@ pipenv install
|
||||||
4. Run `pipenv run ./get_report.py` to get the report, it stores it in a file report.json
|
4. Run `pipenv run ./get_report.py` to get the report, it stores it in a file report.json
|
||||||
5. Run `pipenv run ./report_json_down.py` to download all the reports and pictures
|
5. Run `pipenv run ./report_json_down.py` to download all the reports and pictures
|
||||||
|
|
||||||
|
## Run automatically with a systemd timer
|
||||||
|
|
||||||
|
This will run the script every day at midnight or once you wake up your computer:
|
||||||
|
|
||||||
|
1. `cp systemd/kidsnote.service ~/.config/systemd/user/`
|
||||||
|
2. `cp systemd/kidsnote.timer ~/.config/systemd/user/`
|
||||||
|
3. `systemctl --user daemon-reload`
|
||||||
|
4. `systemctl --user enable --now kidsnote.timer`
|
||||||
|
|
||||||
|
It assumes you already set up the .env file.
|
||||||
|
|
||||||
## Why username and password?
|
## Why username and password?
|
||||||
|
|
||||||
In the old script you had to get the report manually from the browser.
|
In the old script you had to get the report manually from the browser.
|
||||||
|
|
9
systemd/kidsnote.service
Normal file
9
systemd/kidsnote.service
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Download Kidsnote reports and JSON
|
||||||
|
Wants=kidsnote.timer
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
WorkingDirectory=/home/jeena/Projects/kidsnote
|
||||||
|
ExecStart=/usr/bin/pipenv run ./get_report.py
|
||||||
|
ExecStart=/usr/bin/pipenv run ./report_json_down.py
|
9
systemd/kidsnote.timer
Normal file
9
systemd/kidsnote.timer
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Run Kidsnote download script once per day
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=daily
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
Loading…
Add table
Add a link
Reference in a new issue