diff options
author | Tom Atkinson <35272906+teatkin@users.noreply.github.com> | 2018-08-12 15:39:45 +0100 |
---|---|---|
committer | Rahiel Kasim <rahielkasim@gmail.com> | 2018-08-12 16:39:45 +0200 |
commit | 4c04bb0b38a7d6dba129d15e50e34c5ef75abc60 (patch) | |
tree | f58bf0041de5e8c579b3fe0a563f42bfdfe83e67 | |
parent | 101724e3ed74ec4fa56cfa2da0362b99cbb21642 (diff) |
openbsd compatibility (#4)
-rw-r--r-- | giternity.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/giternity.py b/giternity.py index 9463be3..853c303 100644 --- a/giternity.py +++ b/giternity.py @@ -99,9 +99,14 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 0 * * * * giternity giternity\n""" - - with open("/etc/cron.d/giternity", "w") as f: - f.write(cron) + # check if platform is OpenBSD + # as it uses a different crontab location + if sys.platform.startswith('openbsd'): + with open("/var/cron/tabs/giternity", "w") as f: + f.write(cron) + else: + with open("/etc/cron.d/giternity", "w") as f: + f.write(cron) except (FileNotFoundError, PermissionError, CalledProcessError): print("Please run the configuration with root privileges: " + |