How to restart shell script when cpu is 0.0%?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to restart shell script when cpu is 0.0%?
# 8  
Old 03-09-2019
Thank You Bakunin for your detailed explanation,
* I have put shebang to script for crontab tasks.
* During surfing on forums, I realized that there were many different ps variations giving different outputs.


Kind regards
Boris
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with Shell script that monitors CPU Usage

I'm a newbie to shell scripting, I was given this script to modify. This script that monitors when CPU Usage is too high based off the top command. The comparison is not working as it should. Its comparing a decimal to a regualar interger. When it send me an email, it send an email and ignores the... (21 Replies)
Discussion started by: mhannor
21 Replies

2. Shell Programming and Scripting

Shell script to calculate the max cpu usage from the main script

Hi All, I have a script which does report the cpu usuage, there are few output parameter/fields displayed from the script. My problem is I have monitor the output and decide which cpu number (column 2) has maximum value (column 6). Since the output is displayed/updated every seconds, it's very... (1 Reply)
Discussion started by: Optimus81
1 Replies

3. Shell Programming and Scripting

Shell script to monitor process with high CPU

Hi, Linux redhat 5.5 I need to write a kshell script that shows all the process that consume 100% CPU (or more. strange but there are time that top shows higger value that 100) and they are active more than 5 minute. The top command shows all the relevat information: The PID of the cpu ,... (0 Replies)
Discussion started by: yoavbe
0 Replies

4. Shell Programming and Scripting

Restart debian server if one specific process has more than 10 seconds have high cpu load

Hi, could someone give me an example for a debian server script? I need to check a process if the process has a high cpu load (top). If yes the whole server needs to reboot. Thats it, nothing more. ;) Hope someone could help me. Regards woisch (2 Replies)
Discussion started by: woisch
2 Replies

5. UNIX for Advanced & Expert Users

Shell script to monitor cpu and VMstat, iostat

Hi , I am new to scripting. please help me out how to write a script to monitor cpu , vmstat, iostat in Redhat linux. we are doing the load test. Thanks in advance !!!! (1 Reply)
Discussion started by: saanvi
1 Replies

6. Shell Programming and Scripting

Restart Logic for a Korn Shell Master Script

Hello All, I was wondering if someone can help me to develop restart logic for a Korn Shell program (a master script) that I am developing. The program is design to invoke a series of child processes (Korn Shell Scripts) whose function is to create a series of load files on a specified mount... (0 Replies)
Discussion started by: jonesdk5
0 Replies

7. Shell Programming and Scripting

Help on shell script conditional execution when CPU Idle > 60%

I need a shell script that will monitor a few conditions and not execute until the these conditions are met. The problem I'm having is that I can not perform a database snapshot (backup) of a sybaseIQ database unless the CPU Status Idle % is above 60% or the snapshot (backup) fails. If... (2 Replies)
Discussion started by: pancona99
2 Replies

8. HP-UX

how could I use shell script to determine which CPU structure

how could I use shell script to determine which CPU structure because I found that I compile my program under Itanium base that cannot run on the PA-RISC base but PA-RISC program can run on Itanium base i would like to use shell script to know which CPU structure it is,how could i do thanks (1 Reply)
Discussion started by: alert0919
1 Replies

9. Shell Programming and Scripting

need help: shell script to restart apache when no. of processes keeps growing

I need a shell script to kill apache and restart it, in case the number of processes keeps growing. The logic is like the below, but I don't know how to get the number and neither the syntax. Could somebody kindly help? if no_of_processes (ps ax ¦ grep httpd) > 200 then killall httpd... (14 Replies)
Discussion started by: _joshua_
14 Replies

10. Shell Programming and Scripting

suspend/restart a process in shell script

Hi, I have a task that Im stuck on. I have an elementary script named 'myscript' that prints "the script is running" once a second. It runs for 27 seconds. I need to write a 2nd script that starts 'myscript' and takes a parameter '$1' for a number. my 2nd script then needs to pause myscript... (1 Reply)
Discussion started by: daneensign
1 Replies
Login or Register to Ask a Question
WATCHQUAGGA(8)						      System Manager's Manual						    WATCHQUAGGA(8)

NAME
watchquagga - a program to monitor the status of quagga daemons SYNOPSIS
watchquagga [option...] daemon... watchquagga -h | -v DESCRIPTION
watchquagga is a watchdog program that monitors the status of supplied quagga daemons and tries to restart them in case they become unre- sponsive or shut down. To determine whether a daemon is running, it tries to connect to the daemon's VTY UNIX stream socket, and send echo commands to ensure the daemon responds. When the daemon crashes, EOF is received from the socket, so that watchquagga can react immediately. This program can run in one of the following 5 modes: Mode 0: monitor In this mode, the program serves as a monitor and reports status changes. Example usage: watchquagga -d zebra ospfd bgpd Mode 1: global restart In this mode, whenever a daemon hangs or crashes, the given command is used to restart all watched daemons. Example usage: watchquagga -dz -R '/sbin/service zebra restart; /sbin/service ospfd restart' zebra ospfd Mode 2: individual daemon restart In this mode, whenever a single daemon hangs or crashes, the given command is used to restart this daemon only. Example usage: watchquagga -dz -r '/sbin/service %s restart' zebra ospfd bgpd Mode 3: phased zebra restart In this mode, whenever a single daemon hangs or crashes, the given command is used to restart this daemon only. The only exception is the zebra daemon; in this case, the following steps are taken: (1) all other daemons are stopped, (2) zebra is restarted, and (3) other daemons are started again. Example usage: watchquagga -adz -r '/sbin/service %s restart' -s '/sbin/service %s start' -k '/sbin/service %s stop' zebra ospfd bgpd Mode 4: phased global restart for any failure In this mode, whenever a single daemon hangs or crashes, the following steps are taken: (1) all other daemons are stopped, (2) zebra is restarted, and (3) other daemons are started again. Example usage: watchquagga -Adz -r '/sbin/service %s restart' -s '/sbin/service %s start' -k '/sbin/service %s stop' zebra ospfd bgpd Important: It is believed that mode 2 (individual daemon restart) is not safe, and mode 3 (phased zebra restart) may not be safe with cer- tain routing daemons. In order to avoid restarting the daemons in quick succession, you can supply the -m and -M options to set the minimum and maximum delay between the restart commands. The minimum restart delay is recalculated each time a restart is attempted. If the time since the last restart attempt exceeds twice the value of -M, the restart delay is set to the value of -m, otherwise the interval is doubled (but capped at the value of -M). OPTIONS
-d, --daemon Run in daemon mode. When supplied, error messages are sent to Syslog instead of standard output (stdout). -S directory, --statedir directory Set the VTY socket directory (the default value is "/var/run/quagga"). -e, --no-echo Do not ping the daemons to test whether they respond. This option is necessary if one or more daemons do not support the echo com- mand. -l level, --loglevel level Set the logging level (the default value is "6"). The value should range from 0 (LOG_EMERG) to 7 (LOG_DEBUG), but higher number can be supplied if extra debugging messages are required. -m number, --min-restart-interval number Set the minimum number of seconds to wait between invocations of the daemon restart commands (the default value is "60"). -M number, --max-restart-interval number Set the maximum number of seconds to wait between invocations of the daemon restart commands (the default value is "600"). -i number, --interval number Set the status polling interval in seconds (the default value is "5"). -t number, --timeout number Set the unresponsiveness timeout in seconds (the default value is "10"). -T number, --restart-timeout number Set the restart (kill) timeout in seconds (the default value is "20"). If any background jobs are still running after this period has elapsed, they will be killed. -r command, --restart command Supply a Bourne shell command to restart a single daemon. The command string should contain the '%s' placeholder to be substituted with the daemon name. Note that -r and -R options are not compatible. -s command, --start-command command Supply a Bourne shell command to start a single daemon. The command string should contain the '%s' placeholder to be substituted with the daemon name. -k command, --kill-command command Supply a Bourne shell command to stop a single daemon. The command string should contain the '%s' placeholder to be substituted with the daemon name. -R, --restart-all When one or more daemons are shut down, try to restart them using the Bourne shell command supplied on the command line. Note that -r and -R options are not compatible. -z, --unresponsive-restart When a daemon is in an unresponsive state, treat it as being shut down for the restart purposes. -a, --all-restart When zebra hangs or crashes, restart all daemons taking the following steps: (1) stop all other daemons, (2) restart zebra, and (3) start other daemons again. Note that this option also requires -r, -s, and -k options to be specified. -A, --always-all-restart When any daemon (i.e., not just zebra) hangs or crashes, restart all daemons taking the following steps: (1) stop all other daemons, (2) restart zebra, and (3) start other daemons again. Note that this option also requires -r, -s, and -k options to be specified. -p filename, --pid-file filename Set the process identifier filename (the default value is "/var/run/quagga/watchquagga.pid"). -b string, --blank-string string When the supplied string is found in any of the command line option arguments (i.e., -r, -s, -k, or -R), replace it with a space. This is an ugly hack to circumvent problems with passing the command line arguments containing embedded spaces. -v, --version Display the version information and exit. -h, --help Display the usage information and exit. SEE ALSO
zebra(8), bgpd(8), isisd(8), ospfd(8), ospf6d(8), ripd(8), ripngd(8) See the project homepage at <http://www.quagga.net/>. AUTHORS
Copyright 2004 Andrew J. Schorr July 2010 WATCHQUAGGA(8)