1827965 Members
2674 Online
109973 Solutions
New Discussion

In need of a script -

 
SOLVED
Go to solution
A. Clay Stephenson
Acclaimed Contributor

Re: In need of a script -

I didn't see an equivalent to the -C option of HP-UX's ps so try this (it's all one line):
ps -e | grep "syslogd" | grep -v "grep" | nawk '{print $1}'


If that works then use the alternate function I supplied earlier although there I missed an "awk" to "nawk" replacement.
If it ain't broke, I can fix that.
Rob Johnson_3
Regular Advisor

Re: In need of a script -

I decided to call it quits for the evening.
I 'm unable to access that box from home so will try it tomorrow morning.

Can you again re-explain your last post so I'm more clear when I go in to try this again tomorrow morning..the part about the alternate function if the ps -e | grep "syslogd" | grep -v "grep" | nawk '{print $1}'works.


Thank you very much for all the help you've given me this evening!!!


A. Clay Stephenson
Acclaimed Contributor

Re: In need of a script -

I've had enough fun too, but:
# --------------------------------------
get_syslogd_pid()
{
typeset -i PSTAT=0
typeset -i SPID=$(ps -e | grep "syslogd" | grep -v "grep" | nawk '{print $1}')
PSTAT=${?}
echo "${SPID}"
return ${PSTAT}
} # get_syslogd_pid
# -------------------------------------
Take this function and replace the existing
get_syslogd_pid() function in your existing
script. It's a Solaris equivalent and it's purpose is to capture the PID of the currently execting syslogd.
If it ain't broke, I can fix that.
Victor Fridyev
Honored Contributor

Re: In need of a script -

Hi,

Why do you do simple things so complicate ? 8)))

LOGF=var/log/rtrlog
BACKLOG=var/log/rtrlog.bck
MAILF=/tmp/$$
if [ -s $BACKLOGF ]; then
grep -e ":%CISCOWORKS-CampusManager -e LINK_TRUNK $BACKLOGF
else
grep -e ":%CISCOWORKS-CampusManager -e LINK_TRUNK $LOGF
fi > $MAILF
date > $BACKLOGF
tail -f $LOGF>> $BACKLOGF
if [ -s $MAILF ]; then
cat $MAILF | mailx -s subject your@address
fi

By this way you don't have any problem with the logfile.

HTH
Entities are not to be multiplied beyond necessity - RTFM
Peter Nikitka
Honored Contributor

Re: In need of a script -

Hi,

as an addendum to the methog of getting the pid of a process, to pendant of the HP-UX

UNIX95= ps -Csyslogd -o pid=

for Solaris is

pgrep syslogd

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Peter Nikitka
Honored Contributor

Re: In need of a script -

Hi,

as an addendum to the method of getting the pid of a command running, the pendant of the HP-UX

UNIX95= ps -Csyslogd -o pid=

for Solaris is

pgrep syslogd

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"