- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script help needed
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
12-28-2006 07:56 AM
12-28-2006 07:56 AM
But the problem is if the instance is already up then how to make it switch to the next checking of the instance and then the next one within the case statement so that it does not start duplicate instances.
thanks in anticipation,
hunki
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 08:10 AM
12-28-2006 08:10 AM
Re: Script help needed
One way would be to have a 'while' loop that runs until a maximum count of running objects is tallied by the 'case'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 08:12 AM
12-28-2006 08:12 AM
Re: Script help needed
thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 08:31 AM
12-28-2006 08:31 AM
Re: Script help needed
Here is an example with the case statement.
#----------------------------------------
#!/bin/sh
# An example with the case statement
# Reads a command from the user and processes it
echo "Enter your command (who, list, or cal)"
read command
case "$command" in
who)
echo "Running who..."
who
;;
list)
echo "Running ls..."
ls
;;
cal)
echo "Running cal..."
cal
;;
*)
echo "Bad command, your choices are: who, list, or cal"
;;
esac
exit 0
#----------------------------------
Hope this will help,
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 08:36 AM
12-28-2006 08:36 AM
Re: Script help needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 08:50 AM
12-28-2006 08:50 AM
Solutioncheck_REST-A && echo "JBoss - REST-A already running!" ||
(
echo "Starting JBOSS-A";
su - gt -c "nohup /export/home/tmp/mc/jboss-4.0.4.GA/bin/run.sh -c REST-A";
echo "Server startup may take a while - "
)
~hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 09:07 AM
12-28-2006 09:07 AM
Re: Script help needed
Consider something like this:
# cat ./looper
#!/usr/bin/sh
typeset -l REPLY
typeset FLAG_A=0
typeset FLAG_B=0
typeset FLAG_C=0
while true
do
echo "please respond..."
read REPLY
case ${REPLY} in
"a" )
[ ${FLAG_A} = 1 ] && echo "already done" || FLAG_A=1
;;
"b" )
[ ${FLAG_B} = 1 ] && echo "already done" || FLAG_B=1
;;
"c" )
[ ${FLAG_C} = 1 ] && echo "already done" || FLAG_C=1
;;
esac
[ ${FLAG_A} = 1 -a ${FLAG_B} = 1 -a ${FLAG_C} = 1 ] && break
done
echo "done!"
exit 0
...When executed, this script will run forever until it receives an "a", "b" or "c" set of responses. Duplicate responses are ignored. Input can be upper or lower case.
In the absence of a blocking I/O like a 'read' in this script, add a 'sleep' to the loop so that you do not needlessly consume the CPU.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 09:43 AM
12-28-2006 09:43 AM
Re: Script help needed
To check the next checking of the instance after the first check , hope you can use decission making and flow control with " if then else" loop , what do you think.
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 09:45 AM
12-28-2006 09:45 AM
Re: Script help needed
P.S: "0" point pls. Thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2006 08:31 PM
12-28-2006 08:31 PM
Re: Script help needed
Use for loop
eg.
for Instance in REST-A REST-b REST-C
do
check_${Instance} && echo "Already UP ${Instance}"
..
..
..
done
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2006 03:24 AM
12-29-2006 03:24 AM
Re: Script help needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2006 12:01 PM
12-29-2006 12:01 PM
Re: Script help needed
Thanks,
Raj.