10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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
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
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
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
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
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
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
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
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
sv(8) System Manager's Manual sv(8)
NAME
sv - control and manage services monitored by runsv(8)
SYNOPSIS
sv [-v] [-w sec] command services
/etc/init.d/service [-w sec] command
DESCRIPTION
The sv program reports the current status and controls the state of services monitored by the runsv(8) supervisor.
services consists of one or more arguments, each argument naming a directory service used by runsv(8). If service doesn't start with a dot
or slash and doesn't end with a slash, it is searched in the default services directory /etc/service/, otherwise relative to the current
directory.
command is one of up, down, status, once, pause, cont, hup, alarm, interrupt, 1, 2, term, kill, or exit, or start, stop, restart, shutdown,
force-stop, force-reload, force-restart, force-shutdown.
The sv program can be sym-linked to /etc/init.d/ to provide an LSB init script interface. The service to be controlled then is specified
by the base name of the ``init script''.
COMMANDS
status Report the current status of the service, and the appendant log service if available, to standard output.
up If the service is not running, start it. If the service stops, restart it.
down If the service is running, send it the TERM signal, and the CONT signal. If ./run exits, start ./finish if it exists. After it
stops, do not restart service.
once If the service is not running, start it. Do not restart it if it stops.
pause cont hup alarm interrupt quit 1 2 term kill
If the service is running, send it the STOP, CONT, HUP, ALRM, INT, QUIT, USR1, USR2, TERM, or KILL signal respectively.
exit If the service is running, send it the TERM signal, and the CONT signal. Do not restart the service. If the service is down, and
no log service exists, runsv(8) exits. If the service is down and a log service exists, send the TERM signal to the log service.
If the log service is down, runsv(8) exits. This command is ignored if it is given to an appendant log service.
sv actually looks only at the first character of these commands.
Commands compatible to LSB init script actions
status Same as status.
start Same as up, but wait up to 7 seconds for the command to take effect. Then report the status or timeout. If the script ./check
exists in the service directory, sv runs this script to check whether the service is up and available; it's considered to be avail-
able if ./check exits with 0.
stop Same as down, but wait up to 7 seconds for the service to become down. Then report the status or timeout.
reload Same as hup, and additionally report the status afterwards.
restart
Send the commands term, cont, and up to the service, and wait up to 7 seconds for the service to restart. Then report the status or
timeout. If the script ./check exists in the service directory, sv runs this script to check whether the service is up and avail-
able again; it's considered to be available if ./check exits with 0.
shutdown
Same as exit, but wait up to 7 seconds for the runsv(8) process to terminate. Then report the status or timeout.
force-stop
Same as down, but wait up to 7 seconds for the service to become down. Then report the status, and on timeout send the service the
kill command.
force-reload
Send the service the term and cont commands, and wait up to 7 seconds for the service to restart. Then report the status, and on
timeout send the service the kill command.
force-restart
Send the service the term, cont and up commands, and wait up to 7 seconds for the service to restart. Then report the status, and
on timeout send the service the kill command. If the script ./check exists in the service directory, sv runs this script to check
whether the service is up and available again; it's considered to be available if ./check exits with 0.
force-shutdown
Same as exit, but wait up to 7 seconds for the runsv(8) process to terminate. Then report the status, and on timeout send the ser-
vice the kill command.
try-restart
if the service is running, send it the term and cont commands, and wait up to 7 seconds for the service to restart. Then report the
status or timeout.
Additional Commands
check Check for the service to be in the state that's been requested. Wait up to 7 seconds for the service to reach the requested state,
then report the status or timeout. If the requested state of the service is up, and the script ./check exists in the service direc-
tory, sv runs this script to check whether the service is up and running; it's considered to be up if ./check exits with 0.
OPTIONS
-v If the command is up, down, term, once, cont, or exit, then wait up to 7 seconds for the command to take effect. Then report the
status or timeout.
-w sec Override the default timeout of 7 seconds with sec seconds. This option implies -v.
ENVIRONMENT
SVDIR The environment variable $SVDIR overrides the default services directory /etc/service/.
SVWAIT The environment variable $SVWAIT overrides the default 7 seconds to wait for a command to take effect. It is overridden by the -w
option.
EXIT CODES
sv exits 0, if the command was successfully sent to all services, and, if it was told to wait, the command has taken effect to all ser-
vices.
For each service that caused an error (e.g. the directory is not controlled by a runsv(8) process, or sv timed out while waiting), sv
increases the exit code by one and exits non zero. The maximum is 99. sv exits 100 on error.
If sv is called with a base name other than sv: it exits 1 on timeout or trouble sending the command; if the command is status, it exits 3
if the service is down, and 4 if the status is unknown; it exits 2 on wrong usage, and 151 on error.
SEE ALSO
runsv(8), chpst(8), svlogd(8), runsvdir(8), runsvchdir(8), runit(8), runit-init(8)
http://smarden.org/runit/
AUTHOR
Gerrit Pape <pape@smarden.org>
sv(8)