- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Scrip saving time
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
тАО01-26-2005 12:24 AM
тАО01-26-2005 12:24 AM
Scrip saving time
In my daily work I have to run some commands UX to check some lines status if they are in state SOFTBLOCK i have to spo and start it as is shown in file attached.
Could anyone help me with that to create a script to run the command UI than in a different environment giving the command STATUS CIC * * STATE according the printout we decide with line to stop and start.
than to close the environment with Q.
See file attached
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 12:36 AM
тАО01-26-2005 12:36 AM
Re: Scrip saving time
something along these lines:
#!/usr/bin/sh
# Run the ui and stream the input
ui << .eof > /tmp/$$
status cic ** state
q
.eof
# Look for the Softblocks
cat /tmp/$$ | grep -e"SOFTBLOCK" > /tmp/$$_2
rm /tmp/$$
# If file exists and softblocks were found
if [ -s /tmp/$$_2 ]
then
tappman -vps2 -p 33 stop
tappman -vps2 -p 33 start
else
echo "No Softblocks found"
fi
rm /tmp/$$
exit
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 12:42 AM
тАО01-26-2005 12:42 AM
Re: Scrip saving time
tappman -vps2 -p 33 stop
tappman -vps2 -p 33 start
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 12:50 AM
тАО01-26-2005 12:50 AM
Re: Scrip saving time
ui << .eof > /tmp/$$
status cic ** state
q
.eof
cat $file | grep -e"SOFTBLOCK" > /tmp/$$_2
if [ -s /tmp/$$_2 ]
then
# Assumptions
# Output is fixed format
# vps? where ? 0-9
# p ?? where ?? 00-99
proc=`cat /tmp/$$_2 | cut -c38`
ident=`cat /tmp/$$_2 | cut -c40-41`
tappman -vps$proc -p $ident stop
tappman -vps$proc -p $ident start
else
echo "No Softblocks found"
fi
rm /tmp/$$_2
exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 01:20 AM
тАО01-26-2005 01:20 AM
Re: Scrip saving time
#!/usr/bin/sh
# This will allow for multiple entries
ui << .eof > /tmp/$$
status cic ** state
q
.eof
cat /tmp/$$ | grep -e"SOFTBLOCK" > /tmp/$$_2
rm /tmp/$$
while read record
do
part1=`echo $record | awk -F')' '{print $2}'`
part2=`echo $part1 | awk -F' ' '{print $2}'`
proc=`echo $part2 | awk -F'/' '{print $1}'`
ident=`echo $part2 | awk -F'/' '{print $2}'`
tappman -vps$proc -p $ident stop
tappman -vps$proc -p $ident start
done < /tmp/$$_2
rm /tmp/$$_2
exit
Please let us know if this solved the problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 02:21 AM
тАО01-26-2005 02:21 AM
Re: Scrip saving time
If the status is in a file "x" then you can use a perl '-one liner' like:
perl -ne 'if (/comport\/\s+(\d+)\/(\d+).*SOFTBLOCK/) {system "tappman -vps$1 -p $2 stop";system "tappman -vps$1 -p $2 start"}' x
Or you can just have perl do it all (untested!):
perl restart.pl
with
------------- restart.pl ------------
foreach (`status cic * * state`) {
if (/comport\/\s+(\d+)\/(\d+).*SOFTBLOCK/) { system "tappman -vps$1 -p $2 stop";
system "tappman -vps$1 -p $2 start";
}
}
Broken down:
- pick up each line from status command into default string $_
- if you see 'comport' followed by a slash (\/), followed by some whitespace (\s+), followed by some decimals (\d+) remember those in $1 (()) followed by an other slash and some decimals remembers in $2 followed by anything (.*) and 'SOFTBLOCK' ... then
- execute a stop and a start
Hein.
- Tags:
- Perl