both
cat /var/log/asterisk/full.NimbusDemo|grep -i reach
and
cat /var/log/asterisk/full.NimbusDemo|while read i;do if [[ $i =~ REACH || $i =~ Reach ]];then echo $i ;fi;done
found the unreachable notices we wanted. also the “Does this work”|mail myemail address did send me an email
but,
tail -F /var/log/asterisk/full.NimbusDemo|while read i;do if [[ $i =~ “UNREACHABLE!” ]];then echo $i|mail [email protected] ;fi;done
is not sending me an email when the device goes unreachable? any ideas?
dicko
(dicko)
July 11, 2016, 7:38pm
22
Not really, check your mail log.
i altered the command in the rc.local file. You mentioned I needed to run the command?
dicko
(dicko)
July 11, 2016, 7:49pm
24
You should only add anything to rc.local when it is working, debug it first. You will have to kill that script or confuse yourself.
That’s IT!!! I restarted and tested and got the message!! You the man. Thank you very much for your help!
dicko
(dicko)
July 12, 2016, 2:11am
26
Then mark your thread solved.
I’m attempting to revive this on a second system and have two questions:
you mentioned I need to run /etc/rc.local or reboot. Reboot is not an option right now, how to I go about running /etc/rc.local?
I ran cat /var/log/httpd/access_log|while read i;do if [[ $i =~ module=dashboard ]];then echo $i|mail my actual email address ;fi;done
and it works but I want it to stop! Is there any way to stop this cat command?
dicko
(dicko)
April 5, 2019, 9:03pm
28
/etc/rc.local is executable just type it at the bash prompt
ps aux|grep dashboard will reveal the pid of the process
kill (that pid)
1 Like
dicko:
/etc/rc.local
When I run this command it just hangs forever until I cancel it out.
dicko
(dicko)
April 19, 2019, 3:04pm
30
Post the issue of
bash -x /etc/rc.local
My guess is you forgot the terminal & that puts it to the background.
dicko:
bash -x /etc/rc.local
I’m starting to see what might be going on. running your command produces a massive number of entries which probably explains why it’s hanging. I was searching the httpd access file which was massive. It was reading through each line and looking for a match. I truncated the httpd access file and ran the command again to see if it hangs.
This is the search command I placed in the file with your previous help. I tested it with cat first and it worked
tail -F /var/log/httpd/access_log|while read i;do if [[ $i =~ module=dashboard ]];then echo $i|mail [email protected] ;fi;done
dicko
(dicko)
April 19, 2019, 3:23pm
32
Putting the process to the background allows the script to continue, no matter what, the whole idea is that process is always running and will never return.