Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am having problems with this script...It doesn't seem to work. Note: It sends email just fine.

#!/bin/bash

#Reset the queue every morning at 5:00AM PST
#v 1.1 changed email

#Email alert that queue has been reset
#

asterisk -rx 'queue reset stats'
SUBJECT="XXXXX"
EMAIL="XXXX@domain.com"
EMAILMESSAGE="Queue has been reset"
echo "$EMAILMESSAGE" | /bin/mail -s "$SUBJECT" "$EMAIL"
share|improve this question
2  
does asterisk -rx 'queue reset stats' work when typed in the console? (assuming that's the line not working from your script). –  m4573r Oct 4 '12 at 14:08
    
@m4573r Yes it does work manually typing on the console. –  JoyIan Yee-Hernandez Oct 5 '12 at 12:01
    
So what's not working actually? Is it only when run by cron? Does it fail every time? Have you tried other schedules? Have you tried to run the script manually at the same time that your crontab would run it? –  m4573r Oct 5 '12 at 12:16
    
@m4573r Ran the script manually and it worked...now this is really getting weird and interesting....the script is owned by root and the permissions seem to be fine...-rwxr-xr-x 1 root root Any inputs? –  JoyIan Yee-Hernandez Oct 9 '12 at 14:47
    
Well, not really... You should be sure the script is executed, to see if that's the problem or if it comes from the asterisk. In case it does, you should try to log the result of the command see what's causing the error... –  m4573r Oct 9 '12 at 14:52
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.