Hey there,
I have a crontab job setup. In the crontab file, I have a path to a text file. My text file has a wget command (which in turn, executes a PHP file). If the crontab file just has the path to the text file, will it automatically bash (execute) that text file? Or do I need to prefix the path to the text file with bash?
Thanks all! -Steve
From serverfault
LookitsPuck
-
If the file is executable (check if it has x in
ls -l
, if not, then usechmod
to set the executable bit) and the first line contains#!/bin/bash
then it will be interpreted in bash.The other option is, as you suggest, to pass it as an argument to bash:
/bin/bash /path/to/your/file.sh
LookitsPuck : Thanks mate! I will take care of this now.LookitsPuck : So, my script should do the following: 1stline: #!/bin/bash 2ndline: wget insertweburl here Is that correct?Mikael S : Correct. And use `chmod +x` to set the executable bit. Also, you should probably use the full path to wget, since cronjobs usually run a "bare" environment where `$PATH` might not include the directory where the wget binary resides. From L.R.
0 comments:
Post a Comment