I had this script running just fine on my old FreePBX server - however there is something odd happening running this from cron. I need to check that the correct handover of the queue has completed correctly, as I have users with fat fingers logging into the queue!
When running this manually, the email is sent with the contents of queue.txt.
When running from cron, the email is sent but is empty. Any ideas because I am stumped!
# script to email status of On Call Queue every hour
# at quarter past the hour
#!/bin/bash
cd /etc/
NOW=$(date +"%m-%d-%y %H-%M")
asterisk -rx "queue show 700" > /etc/queue.txt
mail -r "[email protected] (XXXXXXXX FreePBX)" -s "On Call Queue Status $NOW" [email protected] < /etc/queue.txt
rm /etc/queue.txt