![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to make your bash script run on a machine with csh and bash | npatwardhan | Shell Programming and Scripting | 3 | 11-19-2008 04:17 AM |
| passing variable from bash to perl from bash script | arsidh | Shell Programming and Scripting | 10 | 06-04-2008 01:25 PM |
| what's wrong with my bash script? | ikk | Shell Programming and Scripting | 4 | 02-22-2008 12:55 AM |
| Problem with Unix script to start remote Tomcat | shrgh | Shell Programming and Scripting | 2 | 02-08-2008 08:23 AM |
| Bash passes flags to shell wrong | andyj | Shell Programming and Scripting | 7 | 07-07-2003 04:01 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Please help to fingure out what wrong with my tomcat restarting bash script
Hi, I am a nbee to Unix, I have used following script to check my tomcat is running or not and restart if it down. but actually it restart my tomcat each time running even my tomcat still running fine:
Script that can run a check and perform an action if the check fails /root/commandchecker.sh (get from http://downloads.rimuhosting.com/commandchecker.sh) /root/istomcatrunning.sh: code: #!/bin/bash tomcatpids=`ps axf --width=200 | grep "\-D[j]ava.endorse" | sed 's/^ *//g' | cut -d ' ' -f 1` if [ -z "$tomcatpids" ]; then # return a 'fail' code return 1 fi return 0 /root/restarttomcat.sh: Code: #!/bin/bash # try to be nice /etc/rc.d/init.d/tomcat stop # but sometimes more drastics measures are necessary if things are not responding kill -9 `ps axf --width=200 | grep "\-D[j]ava.endorse" | sed 's/^ *//g' | cut -d ' ' -f 1` /etc/rc.d/init.d/tomcat start cron job. /etc/cron.d/monitortomcat.cron 0-59/5 * * * * root /root/commandchecker.sh --email youremail@example.com --command "/root/istomcatrunning.sh" --onfail "/root/restarttomcat.sh" --triggeractionafternfails 3 --checkname tomcatcheck > /dev/null" The error I get when script run: /root/istomcatrunning.sh: line 5: return: can only `return' from a function or sourced script /root/istomcatrunning.sh: line 7: return: can only `return' from a function or sourced script failed command result match (25 recently) for '/root/istomcatrunning.sh' expecting ''. recode=1 taking some action: /root/restarttomcat.sh kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] startup taking too long, not getting a response on The UNIX and Linux Forums - Learn UNIX and Linux from Experts, giving up command result mismatch for /root/istomcatrunning.sh, sending email Could anyone help to fingure out what wrong with the script please? Thx a lot. Quyen Nguyen. |
![]() |
| Bookmarks |
| Tags |
| restart tomcat script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|