04-17-2002
1- create a simple Script ver_proc.sh (in a apropiate directory example /usr/local/scripts/varios or /usr/local/sbin/varios)
#!/bin/ksh
if [ $# -ne 1 ]
then
echo "Usage: $0 <proc_name>"
fi
PROC_NAME=$1
DAY=`date +"%Y%m%d"`
TIME=`date +"%Y/%m/%d %H:%M"`
CURR_SCRIPT=$0
if [ ! -d /var/log/$DAY ]
then
mkdir /var/log/$DAY
chmod 0755 /var/log/$DAY
fi
OUT=/var/log/$DAY/ps_$DAY.txt
if [ `ps -ef |grep $PROC_NAME |grep -v $CURR_SCRIPT |grep -v grep |wc -l ` -eq 1 ]
then
echo "$TIME `/usr/ucb/ps vax |grep $PROC_NAME |grep -v $CURR_SCRIPT |grep -v grep`" >> $OUT
else
ps -ef |grep $PROC_NAME |grep -v $CURR_SCRIPT |grep -v grep | while read linea
do
TIME=`date +"%Y/%m/%d %H:%M"`
echo "$TIME $linea" >> $OUT
done
fi
exit 0
2- chmod 0755 /usr/local/scripts/varios/ver_proc.sh
3- create a cron Job.
EDITOR=/usr/bin/vi ; export EDITOR
cron -e
# add the following line
00,30 * * * * [ -x /usr/local/scripts/varios/ver_proc.sh ] \
/usr/local/scripts/varios/ver_proc.sh <proc_name>
4- Modify the script at your flavor
Last edited by hugo_perez; 04-17-2002 at 11:59 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear all,
I'm new in Unix system, I need help about how to create execution file.
for example in my system i have file fg*
when i open fg file i get :
cmd='basename$0'
$cmd "$@"
how to create file like that (execution file) in KSH shell
thank you for your help
heru (4 Replies)
Discussion started by: heru_90
4 Replies
2. Shell Programming and Scripting
Hello All,
My first post on this forum. I am using cygwin to help me with some routine jobs on my laptop, with tcsh as my shell. I need to copy a set of files from one directory to a network drive every minute. So I have
set tperiod = 1
alias periodic 'cp *.txt /cygdrive/z/Data'
... (0 Replies)
Discussion started by: OmniVision
0 Replies
3. Cybersecurity
I need to periodically run a check on the passwords of the users (Redhat 5.0) to verify that all passwords meet minimal standards. I remember seeing a script years ago that grabbed the encrypted passwords from the file and checked if they matched any of the encrypted strings in another file, plus... (1 Reply)
Discussion started by: tlynnch
1 Replies
4. Homework & Coursework Questions
first off let me introduce myself. My name is Eric and I am new to linux, I am taking an advanced linux administration class and we are tasked with creating a script to add new users that anyone can run, has to check for the existence of a directory. if the directory does not exist then it has... (12 Replies)
Discussion started by: pbhound
12 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have a file that looks like this, the unity of information is composed of four lines, and these extends for millions.
My objective is to remove the highligthed "T".
How to attack this? This character is always constant in type "T" and position "1st" but the rest of the line is... (7 Replies)
Discussion started by: sargotrons
7 Replies
6. Programming
Hi
I have a periodic task (with the highest priority) which I away every X nano-second.
I am using the function clock_nanosleep with REAL_TIME timer.
when I wake up, I versify that I was awake on time,
and check if the delta between the last time I get to sleep and the current time is X... (4 Replies)
Discussion started by: laro1983
4 Replies
7. Ubuntu
Ubuntu wireless has been fine until fresh installation of 12.10. Now, I have periodic drops of the wireless. I can manually disconnect and then reconnect to get the service back.
Sometimes, I am unable to disconnect. When this happens, I have to log off and then on again. (0 Replies)
Discussion started by: jamarsh
0 Replies
8. Shell Programming and Scripting
SOLVED, thank you!
Edit2:
Good news everyone,
I managed to get it down to a "simple" problem, but I still have some syntax issues.
Here is the code which troubles me:
awk 'BEGIN{x2=0;x1=0;crit=0;}
$1 < 1000000 {x2=$4; diffx=x2-x1; x1=x2;
diffx > 3.6 ? {crit=1} : {crit=0};... (2 Replies)
Discussion started by: Consti
2 Replies
9. Shell Programming and Scripting
Hi All,
I have a file which is in below shape. Script should run and pick 1 and 2nd line and first line value store in A variable only numeric and 2nd line value should store in B variable only numeric. Then I have command which will check the value of these two tickets if both is having the... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies
10. What is on Your Mind?
Was working on Vue.js and stumbled upon this beautiful Vue project by Kadin Zhang
Periodicity is a dynamic periodic table built with Vue.js that animates and graphs data to aid the visualization of chemical concepts.
The code is available on GitHub (2 Replies)
Discussion started by: Neo
2 Replies
LEARN ABOUT DEBIAN
ns_foreach
ns_lctl(3aolserver) AOLserver Built-In Commands ns_lctl(3aolserver)
__________________________________________________________________________________________________________________________________________________
NAME
ns_for, ns_foreach, ns_while, ns_lctl - Replacements for standard Tcl loop commands which enable monitoring and control
SYNOPSIS
ns_for start test next body
ns_foreach varname list body
ns_foreach varlist1 list1 ?varlist2 list2 ...? body
ns_while test body
ns_lctl cancel id
ns_lctl eval id script
ns_lctl info id
ns_lctl install command
ns_lctl list
ns_lctl pause id
ns_lctl result id
_________________________________________________________________
DESCRIPTION
The ns_for, ns_foreach, and ns_while commands are replacements for cooresponding Tcl commands with the additional capability of monitoring
and control through the ns_lctl command.
ns_for start test next body
See the for(n) man page for usage.
ns_foreach start test next body
See the foreach(n) man page for usage.
ns_foreach varlist1 list1 ?varlist2 list2 ...? body
See the foreach(n) man page for usage.
ns_while test body
See the while(n) man page for usage.
ns_lctl cancel id
Mark the given loop to cancel at the next iteration, resulting in the loop returning with TCL_ERROR.
ns_lctl eval id script
ns_lctl info id
ns_lctl install command
ns_lctl list
ns_lctl pause id
ns_lctl result id
SEE ALSO
for(n), foreach(n), while(n)
KEYWORDS
threads, iteration, list, looping, cancel
AOLserver 4.5 ns_lctl(3aolserver)