]> rtime.felk.cvut.cz Git - hubacji1/coffee-getter.git/commitdiff
Update readme with systemd timers info
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 21 Mar 2019 13:26:36 +0000 (14:26 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 21 Mar 2019 13:35:31 +0000 (14:35 +0100)
README.md

index cefdf92433c642cb56cdfc40d5010b56218760c2..4e5c14d39cdaf4f99edfeab34bd98af68151e7b9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,47 @@
 # Coffeebot getter
 Somehow friendly API to get and share coffee related data from database.
 
+# Development
+## Timers
+For running tasks periodically, please see [Timers][6] and [User][7] pages
+about systemd on archlinux wiki.
+
+The example `top5_mate_stats.service`:
+```
+[Unit]
+Description=Run top 5 Mate drinkers stats
+
+[Service]
+Environment=PYTHONPATH=/path/to/coffee-getter/repo/
+ExecStart=/path/to/coffee-getter/repo/run/top5_mate_stats.py
+```
+
+The example `top5_mate_stats.timer`:
+```
+[Unit]
+Description=Run top 5 Mate drinkers stats each Mon 9am
+
+[Timer]
+OnCalendar=Mon *-*-* 09:00:00
+Persistent=true
+
+[Install]
+WantedBy=timers.target
+```
+
+Both files must be stored in `~/.config/systemd/user/` directory.
+
+Then enable timer and service by:
+```
+systemctl --user enable top5_mate_stats.timer
+systemctl --user enable top5_mate_stats.service
+```
+
+And start timer by:
+```
+systemctl --user start top5_mate_stats.timer
+```
+
 # Contribute
 ## Code
 For quick orientation see the [changelog][1].
@@ -41,3 +82,5 @@ This project is developed under [GNU GPLv3 license][4].
 [3]: http://endoflineblog.com/oneflow-a-git-branching-model-and-workflow
 [4]: ./LICENSE
 [5]: https://docs.python.org/3.5/library/unittest.html
+[6]: https://wiki.archlinux.org/index.php/Systemd/Timers
+[7]: https://wiki.archlinux.org/index.php/Systemd/User