mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 09:02:10 +00:00
Merge pull request #132 from ubldr/freebsdcrontab
FreeBSD crontab(1) needs a "-" to read from stdin
This commit is contained in:
commit
1dd14753c8
@ -7,6 +7,7 @@ import logging
|
|||||||
import itertools
|
import itertools
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
import platform
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
from distutils.spawn import find_executable
|
from distutils.spawn import find_executable
|
||||||
import pwd, grp
|
import pwd, grp
|
||||||
@ -167,7 +168,10 @@ def setup_backups(bench='.'):
|
|||||||
def add_to_crontab(line):
|
def add_to_crontab(line):
|
||||||
current_crontab = read_crontab()
|
current_crontab = read_crontab()
|
||||||
if not line in current_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(current_crontab)
|
||||||
s.stdin.write(line + '\n')
|
s.stdin.write(line + '\n')
|
||||||
s.stdin.close()
|
s.stdin.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user