It looks like the cron does not have $BPY
defined. Is it some_script.py
that needs to be executed? What's the purpose of $BPY
? Also, you should probably need the full path of the script, not just the script's name itself.
Assuming that some_script.py
is the real intended executed script, then try just executing that (with the full path!!)
In your comments below this answer, you said the $BPY
is Python's path. Instead of doing that, you should use a shebang
to specify the full path of the interpreter that is to be used. A common shebang specifying python is: #!/usr/bin/python
. This should be the first line of your some_script.py
file.
As far as the syntax...
Cron format is a simple, yet powerful and flexible way to define time and frequency of various actions.
cron format consists of fields separated by white spaces:
[Min] [Hr] [Day of Month] [Month of Year] [Day of Week]
The following diagram shows what it consists of:
* * * * *
| | | | |
| | | | +---- Day of the Week (range: 0-6, 0 standing for Sunday; Mon,Tue, etc.
| | | | Most OS's recognize Sunday as 0 or 7)
| | | +------ Month of the Year (range: 1-12 or Jan, Feb, etc)
| | +-------- Day of the Month (range: 1-31)
| +---------- Hour (range: 0-23)
+------------ Minute (range: 0-59)
Any of these 6 fields may be an asterisk (*
). This would mean the entire range of possible values, i.e. each minute, each hour, etc. In the first four fields.
Any field may contain a list of values separated by commas, (e.g. 1,3,7
) or a range of values (two integers separated by a hyphen, e.g. 1-5
).
After an asterisk (*
) or a range of values, you can use character /
to specify that values are repeated over and over with a certain interval between them. For example, you can write 0-23/2
in the Hour field to specify that some action should be performed every two hours (it will have the same effect as 0,2,4,6,8,10,12,14,16,18,20,22
). A value of */4
in the Minute field means that the action should be performed every 4 minutes. 1-30/3
means the same as 1,4,7,10,13,16,19,22,25,28
.
In Month and Day of Week fields, you can use names of months or days of weeks abbreviated to first three letters (Jan
,Feb
,...,Dec
or Mon
,Tue
,...,Sun
) instead of their numeric values.
Alternatively, you can use special keywords in lieu of the first 5 fields specified above:
string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
This alternate format is not supported in older, proprietary operating systems like SCO Unix.
,1
so it only read '0
' since the current0,1
will have it running from 12 to just before 2am.