You probably should state how you are editing the crontab file.
A raw edit to /etc/crontab or with crontab -e
You can look in /var/log/syslog for what is actually happening with cron
You probably should state how you are editing the crontab file.
A raw edit to /etc/crontab or with crontab -e
You can look in /var/log/syslog for what is actually happening with cron
Yoe don't say which flavour of the AllStar software you are running. Hamvoip/ASL3.
If ASL3, then all things 'AllStar' run as the asterisk user.
So to create your crontab, you need to run;
sudo crontab -u asterisk -e
This creates a crontab file for the asterisk user.
You then need to make sure that any scripts/directories etc can be run by the asterisk user. (Assihning correct permissions etc)
Tom.
Excuse my typos. Haven't had my coffee yet. "You don't say..." and "Assigning correct pemissions..."
I can only say that I can not guess anymore without additional input.
and the possibility if you are confusing the app_rpt/ASL system scheduler (in rpt.conf)
with crontab OS scheduler. (/etc/crontab)
Very different things. And you can not directly call a shell script from the ASL scheduler, only call a macro which executes a command in rpt.conf, so the assigned command has to call the shell script.
The clue that lead me to think this was the case is when you said you are already using it to call time and other things as crontab is a long way around a short item inside asl scheduler for that..
And if being the case, the script has to be owned by user:group - asterisk:asterisk
because it is being called by user asterisk.
command (where 12345 is the command you assign, can not conflict with existing)
12345=cmd, /path/to/script.sh
macro (macro# & commands separated by a comma ending with a #)
20=12345#
scheduler (macro# to execute and time to execute it in same 5 time fields)
20=* * * * *
Either way the above tells you how to do this with the ASL scheduler.
The script must be owned by user asterisk.
Hi Tom
I am using asl 3. I have the script executable. I am running the cron from crontab -e.
My script is in /etc/asterisk/local the local directory I created to put my scripts in.
I can launch the script from the command line from this local directory using ./my_script.sh
but it will not launch from the cron job, even with the path /etc/asterisk/local ahead of script file.
Thanks for the help
73 Randy VE3JPU
How are you editing the crontab file? And which user owns it? It has to run as root or asterisk if you want it to interact with Asterisk.
Hello Randy,
Did you try creating a new Crontab for the asterisk user? If you run the command I suggested above, you will be presented with a blank/empty crontab file. That is is fine and is expected.
Make sure that your node is not connected to anything. So running standalone.
Add this entry to the bottom of the crontab file.
Note that there is no '.' after local.This sould run the script every minute.
Are you comfortable using PuTTY? Have you tried WinSCP/FileZilla? These are much easier to use than PuTTY and makes editing files a breeze. (I prefer WinSCP).
Tom.
P.S. That should be 5 asterisks before the command. * * * * *
Hi Mike
well it appears I am in way over my head here.I understand that there two crontabs now, didn't before. One for asterisk and one for the system (OS)
I made a text to speech file according to asl 3 manual and I could actually execute it from the command line in /etc/asterisk/local using ./clubmeetings.sh
Yes I made it executable. but I could never get it to execute from a crontab.
Anyway thanks again for your help
73 Randy VE3JPU
Randy, I suggest you use the ASL scheduler till you get a handle on the system cron.
If you are using the system cron (/etc/crontab edits) you should specify the user before the command line.
crontab -e assumes the logged user doing the editing I believe.
For new users, cron was a bit easier to digest until more recent os versions .
All the help on the web often reflects older versions. So when seeking help on the cron issue, you probably should be specific to deb 12.
But I encourage you to stay at it.
Hi again Mike
The script, as it stands right now, if I enter this command
"Casey@node65126:/etc/asterisk/local $ sudo ./clubmeetings.sh" it will execute the Text to Speech script I created with out flaw. but Iit will not execute from a crontab I create. Do I have to create a macro containing this script in order to make the con job work?
Thanks again Mike for your help. ( sorry I am very new to this command line Linux)
Use my above guide, this is all in rpt.conf
command
6999=cmd,:/etc/asterisk/local//clubmeetings.sh
[macro] (a entry # 20 for your command to be executed)
20=6999#
[scheduler] (when do you want the macro 20 called in cron time format)
20=* * * * *
your shell script needs to be owned by asterisk to be called by asterisk
chown asterisk:asterisk /etc/asterisk/local/clubmeetings.sh
So at said time in scheduler, macro 20 is called executing command 6999 that you assigned.
Hi Mike
I have to apologise to you, Tom and the support community for my stupidity
this is how I am able to execute my Text to Speech script file from the command line
Casey@node65126:/etc/asterisk/local $ sudo ./clubmeetings.sh
(my fault for giving you guys the wrong info)
So if I am correct (and at this point I can't trust myself anymore) by entering sudo before ./clubmeetings.sh means I have to be in the root before this will execute from the crontab.
So I Need to know how to execute this file from the crontab
So I hope this clears up things for everyone that has been trying help me.
Sorry for my screw up and thanks in advance for everyone's help.
73 Randy VE3JPU
The best way is to add the cron entry to /etc/cron.d/FILENAME
:
10 06-22 1-12 * * root /etc/asterisk/local/clubmeetings.sh
Note the addition of the "root" column - that's the username the script will run under. You can make "FILENAME" whatever you want. I suggest "allstarlink" or "asl". You don't need to restart cron or anything for this to work.
Can’t get script to run from Crontab UPDATE !!
Greetings to: Tom G0JSV, Mike KB8JNM, Allen WA3WCO, N8EI
I found the solution to my problem, it may not be the proper coding method but it works.
I had created a script file called clubmeetings.sh
It looked like this
asl-tts -n 65126 -t 'mytext'
I changed it to this
sudo asl-tts -n 65126 -t 'mytext'
After I made this change it started playing like crazy, I had the crontab set for every minute.
I will be doing a lot more reading before I waste your time the next time
Thanks again everyone
73 Randy VE3JPU