2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

Merge pull request #132 from ubldr/freebsdcrontab

FreeBSD crontab(1) needs a "-" to read from stdin
This commit is contained in:
Rushabh Mehta 2015-07-31 15:00:51 +05:30
commit 1dd14753c8

View File

@ -7,6 +7,7 @@ import logging
import itertools
import requests
import json
import platform
import multiprocessing
from distutils.spawn import find_executable
import pwd, grp
@ -167,7 +168,10 @@ def setup_backups(bench='.'):
def add_to_crontab(line):
current_crontab = read_crontab()
if not line in current_crontab:
s = subprocess.Popen("crontab", stdin=subprocess.PIPE)
cmd = ["crontab"]
if platform.system() == 'FreeBSD':
cmd = ["crontab", "-"]
s = subprocess.Popen(cmd, stdin=subprocess.PIPE)
s.stdin.write(current_crontab)
s.stdin.write(line + '\n')
s.stdin.close()