LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2006, 10:22 PM   #1
newbie_adm
Member
 
Registered: Jun 2006
Posts: 40

Rep: Reputation: 15
Cron Job


I have created a cron. I used the crontab -e comand. Here is the actual crontab -e
* * * * * /etc/asterisk/chk_asterisk.sh >> /var/log/monitoring/cron/log.txt


here is my chk_asterisk.sh
#!/bin/sh
####################################
# Checking Asterisk Application #
#####################################

for abc in `ps -ef | grep -c asterisk` ; do
if [ "$abc" -eq 0 ] ; then

echo "The asterisk is not running" > /var/log/monitoring/asterisk/cron/down.txt
exit
fi
done


I tried invoking it manually to test the script and it worked. It created some logs from the directory specified above. Bt when I have added it use the crontab -e and inserted it on, the script fails.

Hope someone could he me on this.

Thanks.

Regards
Newbie_adm
 
Old 06-05-2006, 10:34 PM   #2
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 48
Maybe like this:

* * * * * /etc/asterisk/./chk_asterisk.sh >> /var/log/monitoring/cron/log.txt

KC
 
Old 06-05-2006, 11:52 PM   #3
newbie_adm
Member
 
Registered: Jun 2006
Posts: 40

Original Poster
Rep: Reputation: 15
Re:Cron job

It is still the same. There were no logs created in teh specified locations?I guess it is not running? Do I have to edit the /etc/crontab file? How will i resolver this one. Is there ant other file that I would edit?


Regards,
newbie_amd
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job working2hard Programming 6 07-28-2004 09:12 PM
Cron job rajasekarvr Linux - General 4 05-03-2004 05:35 PM
cron job thesnaggle Linux - Newbie 1 09-19-2003 10:47 AM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM
Cron job T-Rex Linux - Newbie 1 09-26-2001 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration