I want to run a python file with bash script for a certain time of the day. I script.sh like this (ofcourse execute it with chmod +x before)
#!/bin/bash
python /home/user/file.py
and with crontab -e I wrote
* 01 * * * /home/user/script.sh
How can I make it run on 1 o'clock?
Edit: I have to run python file from a script because I will add some other things later.
1 Answer 1
Put a shebang/directive in the python script you're trying to run.
Similar to the shell script you gave, this should be the first line in your python script:
#!/usr/bin/python
...or for python version 3:
#!/usr/bin/python3
Sign up to request clarification or add additional context in comments.
Comments
default
* 01 * * * python /home/user/file.pypython. cron does not setPATH.