I have this crontab configuration setup and the following script.
MAILTO="[email protected]"
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 as this
import subprocess
import os
from time import gmtime, strftimedef 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 has begun running but other parts of the script are not finished. I am not sure if its OS fault or cron fault or python. The script by itself runs fine when I invoke it from command line.
Does anyone know why is this happening?