- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep lines under the event header
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
Discussions
Discussions
Forums
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
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
тАО03-30-2009 02:49 AM
тАО03-30-2009 02:49 AM
Re: grep lines under the event header
#!/usr/bin/sh
SMS_RECEIVER=''
HS=$1
MAIL_RECEIVER=""
ssh
print "File system warning of $HS server:" > $HS.mes.txt
function check_slash {
a=`cat $HS.bdf.info|grep -w /`
b=`cat $HS.bdf.info|grep -w /|awk '{print $2}'`
if [[ $b > `expr 55` ]]
then
print "$a%" >> $HS.mes.txt
fi
}
check_slash
function sms {
if [[ -f $HS.mes.txt ]]
then
# /usr/local/bin/lynx -dump `$SMS_RECEIVER `cat $HS.mes.txt``
#/usr/local/bin/lynx -dump "$SMS_RECEIVER `cat $HS.mes.txt`"
mailx -s "File System warning of $HS server:" $MAIL_RECEIVER < $HS.mes.txt
fi
}
sms
I will run the script like this
file.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 07:58 PM - edited тАО09-03-2011 08:57 PM
тАО03-30-2009 07:58 PM - edited тАО09-03-2011 08:57 PM
Re: grep lines under the event header
>I have changed my script
#!/usr/bin/sh
SMS_RECEIVER=''
HS=$1
MAIL_RECEIVER=""
function check_slash {
a=$(grep -w / $HS.bdf.info)
b=$(grep -w / $HS.bdf.info | awk '{print $2}')
if [ $b -gt 55 ]; then
if [ ! -f $HS.reported ]; then
echo 55 > $HS.reported
fi
# report if larger
if [ $b -gt $(< $HS.reported) ]; then
print $b% >> $HS.mes.txt
else
rm -f $HS.mes.txt
fi
echo $b > $HS.reported
else
rm -f $HS.mes.txt $HS.reported
fi
}
function sms {
if [[ -f $HS.mes.txt ]]; then
# /usr/local/bin/lynx -dump $($SMS_RECEIVER $(< $HS.mes.txt) )
#/usr/local/bin/lynx -dump "$SMS_RECEIVER $(< $HS.mes.txt)"
mailx -s "File System warning of $HS server:" \
$MAIL_RECEIVER < $HS.mes.txt
fi
}
ssh @$1 bdf | awk '
NF==1 {f=$0; getline; $0=f$0}
{if ($5+0 > 50) print $6, $5 }' | sed 's/%//' > $HS.bdf.info
print "File system warning of $HS server:" > $HS.mes.txt
check_slash
sms
As JRF mentioned move the functions to the top and just invoke their names.
(I wasn't sure why you had stuttered your single quotes in sed?)
- Tags:
- stutter quotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2009 03:10 AM
тАО03-31-2009 03:10 AM
Re: grep lines under the event header
thanks buddy.
Really appreciate your thought. But i have slightly changed the logic. Its working now.
Hope to get further help from you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2009 07:55 PM
тАО03-31-2009 07:55 PM
Re: grep lines under the event header
Create a shell script which will edit a file content which have some syntax. An user must call this script to modify the file and while saving it will first notify to the group owner of that file. If the owner permit him the script will than save the changes in that file and push the file on all servers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2009 03:32 AM
тАО04-01-2009 03:32 AM
Re: grep lines under the event header
This is vague. Make changes to a copy so you can do the rest.
>it will first notify to the group owner of that file. If the owner permit him the script will than save the changes in that file
You are actually going to send mail to the group owner? Or are you going to check the group permissions and overwrite it anyway if you can?
>push the file on all servers.
Look into rdist?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2009 03:52 AM
тАО04-01-2009 03:52 AM
Re: grep lines under the event header
> another issue
Instead of continuing to add new questions to this thread, you need to create a _NEW_ thread. Part of the value of this community is in being ablt to search threads for solutions and suggested in part based on the original subject. You now have three totally separate questions.
Regards!
...JRF...
- « Previous
- Next »