- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script question here
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2001 10:40 AM
10-03-2001 10:40 AM
script question here
# Get the start time
ssh $i "tail -10 /var/opt/ignite/logs/makrec.log1 2> /dev/null | grep 'Started'" > $TMP_PAGE2
echo "
" >> $TMP_PAGE2
echo $END >> $TMP_PAGE2
# Get the end time - will also use later for COLOR selection
END=$(ssh $i "tail -2 /var/opt/ignite/logs/makrec.log1 2> /dev/null |
grep '^Ended'")
echo "
" >> $TMP_PAGE2
echo "" >> $TMP_PAGE2
# Get the failure code and set the color
FAIL_CODE=$(ssh $i "tail -1 /var/opt/ignite/logs/makrec.log1 2> /dev/null | grep 'Ended' 'makrec.log1' | tail -1")
case $FAIL_CODE in
"Completed" )
COLOR="GREEN"
;;
"Ended" )
COLOR="RED"
;;
* )
COLOR="RED"
;;
esac
# Also set the COLOR based on $END
[ $(echo $END | grep -c Ended) -eq 1 ] && COLOR="GREEN"
# Build the first column - This is where we set the color
echo "" > $TMP_PAGE1
echo "" >> $TMP_PAGE1
echo "$i " >> $TMP_PAGE1
echo "" >> $TMP_PAGE1
echo "
" >> $TMP_PAGE1
# Pull it together
cat $TMP_PAGE1 $TMP_PAGE2 >> $PAGE
done
# end the table
echo "" >> $PAGE
echo "" >> $PAGE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2001 11:11 AM
10-03-2001 11:11 AM
Re: script question here
Check the line
FAIL_CODE=$(ssh $i "tail -1 /var/opt/ignite/logs/makrec.log1 2> /dev/null | grep 'Ended' 'makrec.log1' | tail -1")
Also, 'makrec.log1' in the above should give you an error that makrec.log1 not found.
tail -1 gives you ****** . You may need to make it tail -2.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2001 11:18 AM
10-03-2001 11:18 AM
Re: script question here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2001 11:45 AM
10-03-2001 11:45 AM
Re: script question here
Try this.
remsh $i "tail -10 /var/opt/ignite/logs/makrec.log1 2> /dev/null | grep 'Started
'" > $TMP_PAGE2
echo "
" >> $TMP_PAGE2
echo $END >> $TMP_PAGE2
# Get the end time - will also use later for COLOR selection
LINE=`remsh $i tail -2 /var/opt/ignite/logs/makrec.log1|head -1`
DATE=`echo $LINE |awk '{FS="-";print $2}'`
FAIL_CODE=`echo $LINE |awk '{FS="-";print $1}'`
case $FAIL_CODE in
"Completed " )
COLOR="GREEN"
;;
"Ended " )
COLOR="RED"
;;
* )
COLOR="RED"
;;
esac
# Build the first column - This is where we set the color
echo "" > $TMP_PAGE1
echo "" >> $TMP_PAGE1
echo "$i " >> $TMP_PAGE1
echo "" >> $TMP_PAGE1
echo "
" >> $TMP_PAGE1
# Pull it together
cat $TMP_PAGE1 $TMP_PAGE2 >> $PAGE
# end the table
echo "" >> $PAGE
echo "" >> $PAGE
rm $TMP_PAGE1 $TMP_PAGE2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2001 11:50 AM
10-03-2001 11:50 AM
Re: script question here
It would be better to simply ask grep how many matches it found:
... grep -c Completed ...
if [ $FAIL_CODE -eq 0 ]
then
COLOR=RED
else
COLOR=GREEN
fi
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2001 11:51 AM
10-03-2001 11:51 AM
Re: script question here
Also, I assigned DATE but not used it anywhere. You can use it somewhere in your table.
Also, I didn't understand why you were grepping "Started" in the first sentence. So, I included it as it is..
But if your intention is to find the Starting time, there would be multiple such entries. You can do it like this.
ssh $i cat /var/opt/ignite/logs/makerec.log1|grep 'Started' |tail -1 > $TMP_PAGE2
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2002 02:45 PM
01-23-2002 02:45 PM