The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Jumpstart Issues Solaris 10 soupbone38 SUN Solaris 7 12-08-2008 05:41 AM
Script works on Solaris, not on Linux Silverhood Shell Programming and Scripting 1 10-05-2007 10:52 AM
Script works on Solaris, not on Linux Silverhood Shell Programming and Scripting 0 10-05-2007 10:27 AM
Samba 3.0.14 on Solaris 10 issues Sapna SUN Solaris 0 10-10-2005 03:21 PM
Solaris boot issues xyyz UNIX for Advanced & Expert Users 6 02-14-2003 02:36 PM

Closed Thread
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
  #1 (permalink)  
Old 04-22-2009
kodak kodak is offline
Registered User
  
 

Join Date: Jun 2003
Posts: 51
Are you sure it's running?

Stop redirecting to the log file for the time being, just let it print right out.
  #2 (permalink)  
Old 04-22-2009
LRoberts LRoberts is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 87
Nope it was not running, sorry :-)
Ok restarted it and then tried from command line again.

Code:
bluemarron:/lcl/apps/Tivoli/netcool/omnibus/probes>ps -ef | grep nco_p_syslog | grep -v grep
This is the results....
Code:
tivoli   13226 25357  0 15:49 pts/0    00:00:00 /lcl/apps/Tivoli/netcool/omnibus/probes/linux2x86/nco_p_syslog -manager dc000p.syslog -propsfile /lcl/apps/Tivoli/netcool/omnibus/probes/linux2x86/syslog.dc000p.props -logfile /lcl/prd/data/dc000p/dump/bdump/alert_dc000p.log
  #3 (permalink)  
Old 04-22-2009
LRoberts LRoberts is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 87
Its really strange to me...

I do this from command line...
Code:
bluemarron:/lcl/apps/Tivoli/netcool/omnibus/bin>ps -ef | grep nco_p_syslog | grep -v grep | awk '{print $NF}' | awk -F. '{print $1}' | cut -d '_' -f 2
And the results are...
Code:
dc000p
Which is perfect.

Yet when I do the same thing from a script....
Code:
#!/bin/ksh
# Create and populate array of db syslog probes which are currently running
ps -ef | grep nco_p_syslog | grep -v grep | awk '{print $NF}' | awk -F. '{print $1}' | cut -d '_' -f 2  > $OMNIHOME/bin/syslogfile.dat
set -A syslog_array
syslogfile_name='syslogfile.dat'
The results in the dat file are....
Code:
/lcl/prd/data/dc000p/dump/bdump/alert_dc000p
  #4 (permalink)  
Old 04-22-2009
kodak kodak is offline
Registered User
  
 

Join Date: Jun 2003
Posts: 51
So, why is the script returning just part of the output?
  #5 (permalink)  
Old 04-23-2009
LRoberts LRoberts is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 87
Ok its fixed. The issue was that the script is so long I did not noticed that at the bottom this same dat file was being refilled so the old grep was replacing the new. :-)

Thanks for all the help!
  #6 (permalink)  
Old 04-22-2009
kodak kodak is offline
Registered User
  
 

Join Date: Jun 2003
Posts: 51
Just do:

ps -ef | grep nco_p_syslog | grep -v grep

from the command line. Then put that *same command* in a script and run it from the same place you're running the other script from.

#!/bin/sh
ps -ef | grep nco_p_syslog | grep -v grep

And compare the outputs. You're not going to find out what the difference is until you compare the raw output.

It's entirely possible that the results returned will be different depending on a lot of factors, you'll just have to adjust your script to account for those differences.
Closed Thread

Bookmarks

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 03:16 AM.


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