From: Jiri Vlasak Date: Thu, 21 Mar 2019 13:26:36 +0000 (+0100) Subject: Update readme with systemd timers info X-Git-Tag: v0.1.0~1^2~3 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/coffee-getter.git/commitdiff_plain/f15a2f99001fbd2e0110b741d75362fc1f85060e Update readme with systemd timers info --- diff --git a/README.md b/README.md index cefdf92..4e5c14d 100644 --- 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