The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to monitor process running on server and posting a mail if any process is dead pradeepmacha Shell Programming and Scripting 13 03-06-2009 07:33 AM
[PERL] Running unix commands within Perl Scripts userix Shell Programming and Scripting 1 05-28-2008 07:06 PM
How to create a dummy process of a process already running? shambhu UNIX for Advanced & Expert Users 3 08-31-2007 11:22 AM
daemon running in AIX checking karthikosu UNIX for Dummies Questions & Answers 0 10-24-2006 01:49 PM
checking for a running process from korn cron jph Shell Programming and Scripting 2 05-01-2005 01:27 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-03-2008
pistachio pistachio is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 13
perl scripting for checking if a process is running

Hi All,

I am new to perl and have been trying to write a short script to check a process.Though i havent reached to the stage where i can match the output.
I am trying to pass a variable x with value /opt/RGw/csbp-base/CSBP_BAT.01.00.05/csbp_BAT.01.00.05.jar

and then pass another variable y to check if the process is running in the system

ps -ef | grep -i "csbp_BAT.01.00.05.jar" | grep -v grep |awk -F" " '{print $11}'
Though this command works from the command line.but if i run and print the same via the script i get all messed up

#!/usr/bin/perl
$x="/opt/RGw/csbp-base/CSBP_BAT.01.00.05/csbp_BAT.01.00.05.jar";
$y=`ps -ef | grep -i "csbp_BAT.01.00.05.jar" | grep -v grep |awk -F" " '{print $11}'`;
print "\n";
print "$x \n";
print " \n";
print "$y";
print "\n";
#echo $y;
#if [$x=$y]#then
# echo "1st step completed"
# echo "let me try somemore"
#else
#echo "try again"
#echo "will need to see how it works"
#fi
#exit


Thanks in advance for clearing my doubts.

Br///
pistachio
 

Bookmarks

Tags
perl, process monitor

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0