I have this crontab configuration setting and the following script.
MAILTO=" abc@avc.com " 41 15 * * * /usr/bin/python /home/atweb/Documents/opengrok/setup_and_restart.py > /home/atweb/Documents/opengrok/restart_log.txt 2&>1
And the python script is like
import subprocess import os from time import gmtime, strftime def main(): print(strftime("%a, %d %b %Y %X +0000", gmtime())) print('Running opengrok index..') subprocess.call(["cd", "/home/atweb/Documents/opengrok"]) subprocess.call(["./stop_website"]) print('Stopped website...') subprocess.call(["./index_opengrok"]) print('finished indexing...') subprocess.call(["./setup_opengrok"]) print('setup finished...') subprocess.call(["./start_website"]) print('Finished opengrok index..') if __name__ =='__main__':main()
And this is the output log
Tue, 27 Aug 2013 22:41:01 +0000 Running opengrok index..
For some reason, the script started working, but the other parts of the script are not finished. I am not sure if its an OS error or a cron or python error. The script itself works fine when I call it from the command line.
Does anyone know why this is happening?
source share