Advertisement

06.06.2008 at 07:20AM PDT, ID: 23463787
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.5

crontab not running full script

Asked by courtenayt in Shell Scripting, Unix Operating Systems, Linux Administration

Tags: ,

Hi,

I'm having a very bizarre problem.  I have the script called  svcschk
 (listed below) under the directory scripts.  I have a crontab set up to run it every minute with the following:


[root@teska /]# crontab -l
* * * * *    /scripts/svcschk > /dev/null 2>&1

If I stop tomcat and/or postgres manually and then manually run scripts/svcschk, then both will be restarted (or if only 1 was stopped, the one that was stopped will be restarted).  

The problem I'm having is for some reason, if tomcat and postgres (or just postgres) are stopped, when the crontab runs, it only seems to start tomcat and doesn't start postgres.

Does anyone have any idea what might be causing this bizarre behavior?  I swear that it used to work with no problems.  I'm running CentOs 5.

Thanks,
CourtenayStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
#!/bin/bash
# Services Restarter - Automatically restart tomcat if it dies
/bin/netstat -ln | /bin/grep ":8080 " | /usr/bin/wc -l | /bin/awk '{if ($1 == 0) system("/sbin/service tomcat6 start") }'
# Service Restarter - automatically restart postrgres if it dies
postgres=`/bin/netstat -an | /bin/grep -i listen | /bin/grep ^tcp | /bin/grep 5432`
if [ "$postgres" == "" ]; then
        service postgresql start
fi
 
Loading Advertisement...
 
[+][-]06.06.2008 at 07:29AM PDT, ID: 21729399

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Shell Scripting, Unix Operating Systems, Linux Administration
Tags: unix, shell
Sign Up Now!
Solution Provided By: omarfarid
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.06.2008 at 08:50AM PDT, ID: 21730187

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628