Sponsored Content
Top Forums Shell Programming and Scripting Solaris+Perl script to get process start date Post 302412185 by Evan on Monday 12th of April 2010 03:12:38 AM
Old 04-12-2010
>>> "grep -v $0" which I believe is the Perl program itself
Yes that's right.

>>>> There is no loop for multi-line output.
No problem for this because the processes I monitor are single instance (but you're right: it would be good if the script could handle this scenario or at least send an error message, I'll work on this!).

I made another modification in the "query":
Code:
$PID_SERVICE=`ps -ef | grep -w "$PROC_NAME" | grep -v grep | grep -v $0 | awk '{print \$2}'`;

This way I grep only the exact name of the process.
I suppose that the problem was due to the processes TCPIPSCH and IPSCH.
Two distinct processes but the same final letters: since I use the -w option everything works fine.
No fake results since 5 days ago, when I made the modification.

BTW: What's 24/7/52? 52 weeks~365, what's the difference? Smilie

Thanks for your time!

Kind Regards,
Evan
 

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

to get process start date and time

what is command to get same using ps with switch. I know process id, by specify process id. It should work on solaris and hp-ux I will be happy if for both different commands. (2 Replies)
Discussion started by: naeem ahmad
2 Replies

2. UNIX for Dummies Questions & Answers

start process at assidned date and time

How can I start FTP at assigned DATE and TIME? (6 Replies)
Discussion started by: gd2003
6 Replies

3. Shell Programming and Scripting

Script - How to automatically start another process when the previous process ends?

Hi all, I'm doing automation task for my team and I just started to learn unix scripting so please shed some light on how to do this: 1) I have 2 sets of datafiles - datafile A and B. These datafiles must be loaded subsequently and cannot be loaded concurrently. 2) So I loaded datafile A... (10 Replies)
Discussion started by: luna_soleil
10 Replies

4. Solaris

How to get process start date and time in SOLARIS?

how can I get the process start date and time? using ps command i can get the timstamp for a process, which are started today. and only date (MMM DD) for others. i need to get both for all the running process. please help. Regards, Jagadeeswaran.K (7 Replies)
Discussion started by: Jagadeeswaran.K
7 Replies

5. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

6. Shell Programming and Scripting

Need to capture dates between start date and end date Using perl.

Hi All, Want to get all dates and Julian week number for that date between the start date and end date. How can I achive this using perl? (To achive above functionality, I was connecting to the database from DB server. Need to execute the same script in application server, since databse... (6 Replies)
Discussion started by: Nagaraja Akkiva
6 Replies

7. Shell Programming and Scripting

Extract week start,end date from given date in PERL

Hi All, what i want to do in perl is i should give the date at run time .Suppose date given is 23/12/2011(mm/dd/yyyy) the perl script shold find week start date, week end date, previous week start date,end date,next week start date, end date. In this case week start date will be-:12/19/2011... (2 Replies)
Discussion started by: parthmittal2007
2 Replies
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 05:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy