Reputation: 3620
I have created a Python program which takes 3 to 4 hours to complete its execution when I run it interactively.
Is there any way to run this program in Batch(Background) ?... i.e. Even when I shutdown my machine it will run as expected.
Upvotes: 0
Views: 362
Reputation: 3620
Thanks for the answers.
I had to read Log file and if any error finds, had to send an email with Error Log.
I have done it through below :
- Created a Python program
: Scheduled it to run every 5 mins
: Which will scan log file for Error Code
: If Error Code finds send an email to team with error log
- Deployed program on PCF(Pivotal App Cloud Foundry Server).
- Program runs as per given time frame and works correctly.
Upvotes: 0
Reputation: 1753
If you are running the program remotely on a server then you may run it via using the & flag, as such
python file.py &
this keeps the program running even if the terminal is closed, you can also do
nohup python file.py &
this will write the ouputs(print statements, errors) to nohup.out,
nohup python file.py > myout.out &
you may do this to redirect this output to any file of your choice, rather than nohup.out
I assume this is what you want, since running a program even if a machine is shut doesn't make sense
Upvotes: 1
Reputation: 114
You could possibly use a site like: https://www.pythonanywhere.com/
Upvotes: 2
Reputation: 53
You can use windows task scheduler, simply set up time trigger or a startup trigger and the action should be your python file.
Upvotes: 1