#!/usr/bin/python3
import os, pexpect
child = pexpect.spawn('/bin/bash -c -i "EDITOR=/usr/bin/vim.tiny /usr/bin/crontab -e"' , ignore_sighup='True')
child.logfile_read = open('/tmp/makecrontabreadlog', 'wb')
child.logfile_send = open('/tmp/makecrontabsendlog', 'wb')
child.expect('dom mon dow')
child.delaybeforesend = 1
child.sendcontrol(']')
child.send(':wq!')
child.send('\r\n')
child.close
os.remove('/tmp/makecrontabreadlog')
os.remove('/tmp/makecrontabsendlog')
raise SystemExit(0)
