Hi,
I have tried to run below command to get a output as text file using crontab, but it’s showing empty
*/1 * * * * asterisk -rx “sip show peers” | grep OK >> test.txt
and also saved this in one shell script as a.sh & gave 755 file pemission, tried below thing using crontab… same thing happened.
*/1 * * * * sh a.sh
#vi a.sh
!/bin/bash
system_page - A script to produce an system information HTML file
Constants
TITLE=“System Information for $HOSTNAME"
RIGHT_NOW=$(date +”%x %r %Z")
TIME_STAMP=“Updated on $RIGHT_NOW by $USER”
function show_uptime
{
# Temporary function stub
echo "Show_uptime"
w
}
function live_peers
{
echo "Live devices"
asterisk -rx “sip show peers” | grep -i OK
}
echo " **************************************************************************************************************************"
echo
echo " $(show_uptime)"
echo
echo " $(live_peers)“
echo
echo " ***************************************************************************************************************************”
output
Show_uptime
17:58:01 up 1:06, 2 users, load average: 0.98, 1.06, 0.99
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 10.10.1.30 16:54 1:03m 0.00s 0.00s rasterisk r
root pts/1 10.10.1.251 17:09 0.00s 0.09s 0.09s -bash
Live devices
~
Please help me to fix this issue.
Regards,
kalyanasundaram