-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
26 lines (18 loc) · 652 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
from _config import basedir
import os
CRON_FILENAME = "/etc/cron.daily/notifier_mail"
def main():
# read the cron templete
cron_tmpl = open("./mail_sender/cron.script.tmpl", 'r')
# setup the right path in the cron file
cron_content = cron_tmpl.read().replace("{{PROJECT_ROOT}}", basedir)
cron_tmpl.close()
# write the cron file (we need permision for this)
cron_file = open("/etc/cron.daily/notifier_mail", 'w')
cron_file.write(cron_content)
cron_file.close()
# setup the right premissions for the file
os.chmod(CRON_FILENAME, 0o751)
if '__main__' == __name__:
main()