Sponsored Content
Full Discussion: Using the watch command
Top Forums Shell Programming and Scripting Using the watch command Post 302991491 by SkySmart on Saturday 11th of February 2017 02:28:42 PM
Old 02-11-2017
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:

Code:
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 suppose to run the watch command continuously looking for the word "openssl" in the process table.
when it finds any process that has the word, its suppose to copy the entire line from the process table containing the "openssl" command and then log it to a file called logfile.

however, this isnt working as expected. when i view the logfile all i see is a bunch of empty lines and blank spaces and these weird characters:

Code:
;80H^[[1;13H1^[[24;80H^[[1;13H2^[[24;80H^[[1;13H3^[[24;80H^[[1;13H4^[[24;80H^[[1;13H5^[[24;80H^[[1;13H6^[[24;80H^[[1;13H7^
[[24;80H^[[1;13H8^[[24;80H^[[1;13H9^[[24;80H^[[1;12H40^[[24;80H^[[1;13H1^[[24;80H^[[1;13H2^[[24;80H^[[1;13H3^[[24;80H^[[1;13H4^[[24;80H^
[[1;13H5^[[24;80H^[[1;13H6^[[24;80H^[[1;13H7^[[24;80H^[[1;13H8^[[24;80H^[[1;13H9^[[24;80H^[[1;12H50^[[24;80H^[[1;13H1^[[24;80H^[[1;13H2^[
[24;80H^[[1;13H3^[[24;80H^[[1;13H4^[[24;80H^[[1;13H5^[[24;80H^[[?1049h^[[1;24r^[(B^[[m^[[4l^[[?7h^[[H^[[2J^[[24;80H^[[?1049h^[[1;24r^[(B^[[m^[[4l^[[?7h^[[H^[[2J^[[24;80H

how can the watch command be fixed to do what i want?
 

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. UNIX for Dummies Questions & Answers

watch command

Hi, Please help me out! In the man pages they dont talk about any options that can be used to terminate a running 'watch' command. Do you know a way of terminating the command using an option? Thanks (1 Reply)
Discussion started by: foxtron
1 Replies

6. 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

7. 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
sane-hs2p(5)						   SANE Scanner Access Now Easy 					      sane-hs2p(5)

NAME
sane-hs2p - SANE backend for Ricoh SCSI flatbed/ADF scanners DESCRIPTION
The sane-hs2p library implements a SANE (Scanner Access Now Easy) backend that provides access to the Ricoh IS450 family of scanners. Should also work with the IS420, IS410, and IS430 scanners, but these are untested. Please contact the maintainer or the sane-devel mail- ing list if you own such a scanner. This backend is alpha-quality. It may have bugs and some scanners haven't been tested at all. Be careful and pull the plug if the scanner causes unusual noise. DEVICE NAMES
This backend expects device names of the form: special Where special is either the path-name for the special device that corresponds to a SCSI scanner. The program sane-find-scanner helps to find out the correct device. Under Linux, such a device name could be /dev/sg0 or /dev/sga, for example. See sane-scsi(5) for details. CONFIGURATION
The contents of the hs2p.conf file is a list of device names that correspond to SCSI scanners. Empty lines and lines starting with a hash mark (#) are ignored. See sane-scsi(5) on details of what constitutes a valid device name. FILES
/etc/sane.d/hs2p.conf The backend configuration file (see also description of SANE_CONFIG_DIR below). /usr/lib64/sane/libsane-hs2p.a The static library implementing this backend. /usr/lib64/sane/libsane-hs2p.so The shared library implementing this backend (present on systems that support dynamic loading). ENVIRONMENT
SANE_CONFIG_DIR This environment variable specifies the list of directories that may contain the configuration file. Under UNIX, the directories are separated by a colon (`:'), under OS/2, they are separated by a semi-colon (`;'). If this variable is not set, the configura- tion file is searched in two default directories: first, the current working directory (".") and then in /etc/sane.d. If the value of the environment variable ends with the directory separator character, then the default directories are searched after the explic- itly specified directories. For example, setting SANE_CONFIG_DIR to "/tmp/config:" would result in directories "tmp/config", ".", and "/etc/sane.d" being searched (in this order). SANE_DEBUG_HS2P If the library was compiled with debug support enabled, this environment variable controls the debug level for this backend. A value of 255 prints all debug output. Smaller values reduce verbosity. CURRENT STATUS
The hs2p backend is now in version 1.00. All major scanning-related features are supported, except for those features requiring the optional IPU. Scanning from the flatbed or ADF (either simplex or duplex) is supported. Lineart, halftone, 4-bit gray, and 8-bit gray are supported. Pre-set gamma tables and halftone patterns are supported, as well as brightness, threshold, contrast. Also supported is scan wait mode, binary and gray filtering, negative scanning, and absolute or relative white setting. Printing with the optional endorser also is supported. PLANNED FUNCTIONALITY
This scanner can scan from the ADF in continuous simplex mode. Surprisingly, many scanners scan an entire document from the ADF into mem- ory before ejecting the sheet. Thus if the document is too long, the scanner cannot hold the entire image data in memory. But if the scan- ner would send its image data when its memory got full, and then read the next buffer's worth of data, continuous scanning could be achieved. MISSING FUNCTIONALITY
The SCSI commands for uploading (2AH) or downloading (28H) custom halftone patterns (02H) and gamma vectors (03H) should work, but require implementing the SANE Option-Value code to allow the user to create the tables to be uploaded to the scanner. No support for Maintenance Data (80H) is planned as this functionality is more suited to a stand-alone utility to be used by a technician when replacing the lamp or ADF unit. Nor is support for reading or changing IPU (93H) paramters and adjustments planned, since my IS450 lacks such a unit. The 31-byte Auto Photo/Letter struct and 21-byte Dynamic threshold struct are documented in the hs2p-scsi.h file should someone wish to use their IPU for image data processing. SEE ALSO
sane(7), sane-find-scanner(1), sane-scsi(5), AUTHOR
jeremy <jeremy@acjlaw.net> Maintained by Jeremy Johnson <jeremy@acjlaw.net> 13 Jul 2008 sane-hs2p(5)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy