Greeting to the Group
I am hoping that some of the asl3/linux guru's can help me with a slight problem I'm have to get a script file to execute from a crontab..
I have made the a text to speech script that works perfectly when I launch it with command ./clubmeetings.sh from the command line, Casey@node65126:/etc/asterisk/local $
but it won't execute from my crontab.
This is my crontab entry 10 06-22 1-12 * * /etc/asterisk/local./clubmeetings.sh
I am almost positive it is a path name problem but I'm stuck at this point.
If anyone can give me some direction on this, I would appreciated it greatly.
Thanks in Advance
Randy VE3JPU
It looks like you have a "." after "local". Did you want "/etc/asterisk/local/clubmeetings.sh" ?
Thanks for the response.
the ./ was the command I used to execute the script from the command line. Looking at it now I should have had a space after the path, but I have tried all kinds of combinations and no luck.
Yes, if you first changed your directory to /etc/asterisk/local
and then wanted to exec the script you might use ./clubmeetings.sh
.
But, in a crontab entry you are specifying the full path of the command to be executed. In your case, wouldn't that be /etc/asterisk/local/clubmeetings.sh
(no periods, no spaces, ...) ?
is the script marked as executable as owner/root ?
Hi Mike
this is the script -rwxr-xr-x 1 root root 204 Jun 5 17:59 clubmeetings.sh
I have since my cron job to fire every minute while testing but I have tried this and it still won't work
0-59 * * * /etc/asterisk/local/clubmeetings.sh
As I said in a previous post I can launch it from within the local directory using ./clubmeetings.sh but so far no luck with this entry.
73 Randy
Did you start your shell script off with a shebang on the very first line ?
#!/bin/bash
Can you run the script manually ?
A crontab entry has 6 fields. Here, you only have 5.
(10)-1 (06-22)-2 (1-12)-3 * * =5
My crontab has only 5 fields.
Example of job definition:
.---------------- minute (0 - 59)
| .------------- hour (0 - 23)
| | .---------- day of month (1 - 31)
| | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* * * * *
But this may come back to user definition.
Depends on how you edited the file.
As I remember this issue, for each user has it's own crontab in newer debian installs..
Something i am not use to myself because I always run as root.
You may have to google that.
yes I can run run it with ./
before you google that, try this
0-59 * * * root /etc/asterisk/local/clubmeetings.sh
Yes I have #!/bin/bash as the first line
This crontab entry only has 5 fields (including the command). You need an extra *
0-59 * * * * /etc/asterisk/local/clubmeetings.sh
Thanks catching that one,but that was not the problem
did you forget this ?
sudo service cron reload
OOOOOkay so your saying by what I'm reading that I must restart the cron service with this command after a cron entry? Never done that before.
Just so everyone is aware, I already have two crons running to spit out the time and weather at the top and bottom of hr and they work no problem
Here, I wonder if the script itself is being exec'd (being started) but just not doing what you want. When I've had to troubleshoot this type of problem I will modify the script so taht it exec's a very simple command at the start of the script ... just to let me know it's been started. For example, you might start your script off with :
#!/bin/bash
date >> /tmp/my-script-is-running
... and here is where the rest of the script would start ...
Then, you can look at the contents of the file to see when it was last started. If you have "cron" setup to run every minute you should see a new line added to the file every minute. And, once you know the script is running, then you investigate why the commands in the script are not doing what you want.
You must restart cron service after a change to make that change active.
Think of it as a change to rpt.conf after a change if you will.
You changed the file, but not the 'active loaded values' which are read at startup/restart