Sponsored Content
Full Discussion: watch command
Top Forums UNIX for Dummies Questions & Answers watch command Post 302335226 by jim mcnamara on Friday 17th of July 2009 04:55:21 PM
Old 07-17-2009
watch runs until interrupted.

IF you are at the command line, CTRL-C will stop the command - unless watch is called from inside a shell script with SIGINT trapped. (bash or ksh trap command)

If watch is a separate process,
Code:
kill -9 pid

where pid == process id of the process will terminate the process.
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Linux watch command on AIX?

On Linux I could use the `watch` command to loop a command X times. Is there a similar command on AIX? If not, is there a way to write a loop on the command line to do this? Linux: watch -d -n 60 'db2 list applications show detail | grep Connect | wc -l' AIX: ??? (2 Replies)
Discussion started by: djschmitt
2 Replies

2. Solaris

Any command to watch output repeatedly??

Hi Experts,, Can you tell me "Is there any command in solaris that gives the output repeatedly for every x seconds" when used with other commands like ls,du,df,etc..Like prstat updates its output for every 5 seconds.. If i want to view how much of disk usage is going on a filesystem for every... (2 Replies)
Discussion started by: sdspawankumar
2 Replies

3. Shell Programming and Scripting

Folder Watch

Hi there, I was wondering if there was a way in UNIX that I could set up a running script that monitors a certain folder (and all the folders and files contained within it) so that if any file changes then it will be the change logged within a log file. I dont know if this is possible in Unix... (6 Replies)
Discussion started by: lodey
6 Replies

4. Shell Programming and Scripting

Command similar to watch

Hi all, I am trying to create a file that shows the CPU usage, constantly updating (similar to TOP). So far i have a file (called test) containing: echo "The current CPU usage is:" `ps -e -o pcpu|awk 'NR > 0 { s +=$1 }; END {print s"%"}'` and then I ran the command: watch -d 0.5 -t... (3 Replies)
Discussion started by: mikejreading
3 Replies

5. HP-UX

looking for a unix command for hpux - watch

watch is a common linux command that executes a program periodically, showing output fullscreen. I couldn't find anything for hpux, so I created the following shell which the user is testing: cat /usr/bin/watch #!/bin/sh while ; do clear echo "Command: $*" date echo "" ... (2 Replies)
Discussion started by: mr_manny
2 Replies

6. Shell Programming and Scripting

Use script to monitor command output question? (like Linux watch)

Hi I want to write a script, help me to monitor command output. This script like Linux "watch" command. Below is my script: # cat watch.sh #!/bin/bash while true do clear echo "command: $*" ( $* ) sleep 2 done Then I run this script below (2 Replies)
Discussion started by: nnnnnnine
2 Replies

7. Shell Programming and Scripting

Using the watch command

so i have a very long script which i have to run. when i run this script, i want to monitor the the openssl commands it runs. the way ive attempted to do this is: watch -t -n 1 "(date '+TIME:%H:%M:%S' ; ps aux | egrep openssl | egrep -v grep)" 2>&1 | tee -a logfile the above command is... (2 Replies)
Discussion started by: SkySmart
2 Replies
kill(1) 						      General Commands Manual							   kill(1)

NAME
kill - send a signal to a process; terminate a process SYNOPSIS
signame] pid ... signum] pid ... Obsolescent Versions: DESCRIPTION
The command sends a signal to each process specified by a pid process identifier. The default signal is which normally terminates pro- cesses that do not trap or ignore the signal. Options recognizes the following options: List all values of signame supported by the implementation. No signals are sent with this option. The symbolic names of the signals (without the prefix) are written to standard output, separated by spaces and newlines. Send the specified signal name. The default is number signame can be specified in upper- and/or lowercase, with or without the prefix. These val- ues can be obtained by using the option. The symbolic name represents signal value zero. See "Signal Names and Numbers" below. Send the specified decimal signal number. The default is See "Signal Names and Numbers" below. (Obsolescent.) Equivalent to (Obsolescent.) Equivalent to Operands pid is a process identifier, an unsigned or negative integer that can be one of the following: The number of a process. All processes, except special system processes, whose process group ID is equal to the process group ID of the sender. All processes, except special system processes, if the user has appropriate privileges. Otherwise, all processes, except special system processes, whose real or effective user ID is the same as the user ID of the sending process. All processes, except special system processes, whose process group ID is equal to the absolute value of pid and whose real or effective user ID is the same as the user of the sending process. Process numbers can be found with the command (see ps(1)) and with the built-in command available in some shells. Signal Names and Numbers The following table describes a few of the more common signals that can be useful from a terminal. For a complete list and a full descrip- tion, see the header file and the manual entry signal(5). signum signame Name Description ---------------------------------------------------------------------------- 0 SIGNULL Null Check access to pid 1 SIGHUP Hangup Terminate; can be trapped 2 SIGINT Interrupt Terminate; can be trapped 3 SIGQUIT Quit Terminate with core dump; can be trapped 9 SIGKILL Kill Forced termination; cannot be trapped 15 SIGTERM Terminate Terminate; can be trapped 24 SIGSTOP Stop Pause the process; cannot be trapped 25 SIGTSTP Terminal stop Pause the process; can be trapped 26 SIGCONT Continue Run a stopped process the null signal, invokes error checking but no signal is actually sent. This can be used to test the validity or existence of pid. the (default) terminate signal, can be trapped by the receiving process, allowing the receiver to execute an orderly shutdown or to ignore the signal entirely. For orderly operations, this is the preferred choice. the kill signal, forces a process to terminate immediately. Since cannot be trapped or ignored, it is useful for terminating a process that does not respond to The receiving process must belong to the user of the sending process, unless the user has appropriate privileges. As a single special case, the continue signal SIGCONT can be sent to any process that is a member of the same session as the sending process. RETURN VALUE
Upon completion, returns with one of the following values: At least one matching process was found for each pid operand, and the specified signal was successfully processed for at least one matching process. An error occurred. EXAMPLES
The command: signals process number 6135 to terminate. This gives the process an opportunity to exit gracefully (removing temporary files, etc.). The following equivalent commands: terminate process number 6135 abruptly by sending a signal to the process. This tells the kernel to remove the process immediately. WARNINGS
If a process hangs during some operation (such as I/O) so that it is never scheduled, it cannot die until it is allowed to run. Thus, such a process may never go away after the kill. Similarly, defunct processes (see ps(1)) may have already finished executing, but remain on the system until their parent reaps them (see wait(2)). Using to send signals to them has no effect. Some non-HP-UX implementations provide only as a shell built-in command. DEPENDENCIES
This manual entry describes the external command and the built-in command of the POSIX shell (see sh-posix(1)). Other shells, such as C and Korn (see csh(1) and ksh(1) respectively), also provide as a built-in command. The syntax for and output from these built-ins may be different. SEE ALSO
csh(1), ksh(1), ps(1), sh(1), sh-posix(1), kill(2), wait(2), signal(5). STANDARDS CONFORMANCE
kill(1)
All times are GMT -4. The time now is 05:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy