Script to auto restart java for 100 percent


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to auto restart java for 100 percent
# 1  
Old 06-27-2016
Script to auto restart java for 100 percent

I want the tomcat to restart when java goes 100% cpu utilize and remain on this , Get pid kill and start tomcat .

Code:
top | grep java

We can get pid and cpu utilize , But how can we do on run time.



Moderator's Comments:
Mod Comment Please use code tags as required by forum rules!

Last edited by RudiC; 06-27-2016 at 01:10 PM.. Reason: Added code tags.
# 2  
Old 06-28-2016
Quote:
Originally Posted by kaushik02018
I want the tomcat to restart when java goes 100% cpu utilize and remain on this , Get pid kill and start tomcat .

Code:
top | grep java

We can get pid and cpu utilize , But how can we do on run time.

If you already have the script to monitor CPU & restart ... add that script to crontab and run the script every minute or whatever frequency that suits you.



Moderator's Comments:
Mod Comment Please use code tags as required by forum rules!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

2. UNIX for Advanced & Expert Users

Opinion on auto-restart of failed apps/services

I'm becoming a dying breed where I work. More and more sys admins are advocating automatically restarting failed services such as tomcat, jboss, etc. I've always been against doing this except with buggy apps that can't be fixed or avoided. My main argument is that I feel it's a trick used by... (9 Replies)
Discussion started by: mglenney
9 Replies

3. Shell Programming and Scripting

Auto restart script does not work

I have a service that are not 100% stable and stops from time to time. So I have a script that do restart the service if it does not run. This script works win on Ubuntu 9.04 but will not start the service in Ubuntu 10.10 If I run the part that do starts the service from CLI, it starts... (2 Replies)
Discussion started by: Jotne
2 Replies

4. Shell Programming and Scripting

How to restart a script?

Hello, I created a shell script in /etc/init.d and it already runs at boot. However I cannot figure out how to make it run just like typing "scrip_name start" I can run it like this ./script_name but since I am doing remote log in whenever I log off the script stops and I also don't want to run... (8 Replies)
Discussion started by: kizofilax
8 Replies

5. HP-UX

Script to auto restart a service

Hi All, May i please know if it is possible to write a script to check the log messages and automatically restart a service if it is failed or it is stopped. Appreciate your suggestions. Thanks in advance. regards, Eajaz (2 Replies)
Discussion started by: ajazshariff
2 Replies

6. Shell Programming and Scripting

Any Restart Script?

Hi, I would like to check if there's any sample of restart script for my AIX server. I'm planning to restart it every month. Thanks. (5 Replies)
Discussion started by: ademah
5 Replies

7. AIX

Hard disk usage is 100 Percent Busy for any command

hi, AIX 5.3 For any command(say tar command) I am getting 100% busy for my hdisk. But my CPU and Memory is not busy and have more idle also. Please advice for any performance analysing. Thanks in Advance, (3 Replies)
Discussion started by: npcrao
3 Replies

8. UNIX for Dummies Questions & Answers

Restart Script

Hi, I am writing a script and need to goto the start of the script if an incorrect command is wrongly entered what can i do. Andy (1 Reply)
Discussion started by: chapmana
1 Replies

9. Shell Programming and Scripting

Auto Detection/Restart of Sybase Deadlocks

Does anyone have an example of a ksh script that executes a Sybase stored procedure, via the ISQL command, and can detect a deadlock and loop until the process completes successfully? I'm a little confused on where to start. Thanks in advance for any assistance you can provide. (0 Replies)
Discussion started by: BCarlson
0 Replies
Login or Register to Ask a Question