GGG
GGG

Reputation: 71

running python file with a bash script

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.

Upvotes: 0

Views: 4698

Answers (1)

Frumpled Biscuit
Frumpled Biscuit

Reputation: 147

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

Upvotes: 1

Related Questions