HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Nested if statement help
Operating System - HP-UX
1837896
Members
3351
Online
110122
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
09-25-2002 04:13 AM
09-25-2002 04:13 AM
Hi everyone.
Currently implementing UniQ , upgrade from openspool. Problem is when attempting to remsh and pass print to another server that may or may not be running UniQ
Usual scenario , I have to ammend a script written some time ago in a galaxy.......
I need to check the status of an error code before performing a set of commands. I need then to perform an action depending on the status code of the last command etc etc
Have a look and see if you can see what is wrong with what I have up to now
# Check to see if the host is running UniQ
remsh $host -n 'ps -ef | grep uq | grep -v grep'
if [[ $? != 0 ]]
then
this_host=$(hostname)
title="remote print from $this_host to $QUEUE@$host via $host_path user $user"
command="np -q$QUEUE -boff $form $font $opts -T'$title' $name"
command="remsh $host -l remprt $command"
output=$($command 2>&1)
status=$?
if [[ $status != 0 ]]
then
ERROR="MSG: remprt failed [$status]\nCOMMAND: $command\nOUTPUT: $output"
error_routine
fi
# If the host is running UniQ then source the setup
else
this_host=$(hostname)
title="remote print from $this_host to $QUEUE@$host via $host_path user $user"
command="np -q$QUEUE -boff $form $font $opts -T'$title' $name"
command="remsh $host -l remprt '. /usr/UniQ/print/setup;$command'
output=$($command 2>&1)
status=$?
if [[ $status != 0 ]]
then
ERROR="MSG: remprt failed [$status]\nCOMMAND: $command\nOUTPUT: $output"
error_routine
fi
fi
Any help appreciated. Thanks in advance
Steve
Currently implementing UniQ , upgrade from openspool. Problem is when attempting to remsh and pass print to another server that may or may not be running UniQ
Usual scenario , I have to ammend a script written some time ago in a galaxy.......
I need to check the status of an error code before performing a set of commands. I need then to perform an action depending on the status code of the last command etc etc
Have a look and see if you can see what is wrong with what I have up to now
# Check to see if the host is running UniQ
remsh $host -n 'ps -ef | grep uq | grep -v grep'
if [[ $? != 0 ]]
then
this_host=$(hostname)
title="remote print from $this_host to $QUEUE@$host via $host_path user $user"
command="np -q$QUEUE -boff $form $font $opts -T'$title' $name"
command="remsh $host -l remprt $command"
output=$($command 2>&1)
status=$?
if [[ $status != 0 ]]
then
ERROR="MSG: remprt failed [$status]\nCOMMAND: $command\nOUTPUT: $output"
error_routine
fi
# If the host is running UniQ then source the setup
else
this_host=$(hostname)
title="remote print from $this_host to $QUEUE@$host via $host_path user $user"
command="np -q$QUEUE -boff $form $font $opts -T'$title' $name"
command="remsh $host -l remprt '. /usr/UniQ/print/setup;$command'
output=$($command 2>&1)
status=$?
if [[ $status != 0 ]]
then
ERROR="MSG: remprt failed [$status]\nCOMMAND: $command\nOUTPUT: $output"
error_routine
fi
fi
Any help appreciated. Thanks in advance
Steve
take your time and think things through
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2002 04:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2002 04:31 AM
09-25-2002 04:31 AM
Re: Nested if statement help
How about sprucing it up a little?
remsh $host -n 'ps -ef | grep uq | grep -v grep'
errchk=$?
#
this_host=$(hostname)
title="remote print from $this_host to $QUEUE@$host via $host_path user $user"
command="np -q$QUEUE -boff $form $font $opts -T'$title' $name"
#
# did remsh work?
#
if [[ $errchk != 0 ]]
then
command="remsh $host -l remprt $command"
output=$($command 2>&1)
status=$?
else
command="remsh $host -l remprt '. /usr/UniQ/print/setup;$command'"
output=$($command 2>&1)
status=$?
fi
#
# check error status
#
if [[ $status != 0 ]]
then
ERROR="MSG: remprt failed [$status]\nCOMMAND: $command\nOUTPUT: $output"
error_routine
fi
live free or die
harry
remsh $host -n 'ps -ef | grep uq | grep -v grep'
errchk=$?
#
this_host=$(hostname)
title="remote print from $this_host to $QUEUE@$host via $host_path user $user"
command="np -q$QUEUE -boff $form $font $opts -T'$title' $name"
#
# did remsh work?
#
if [[ $errchk != 0 ]]
then
command="remsh $host -l remprt $command"
output=$($command 2>&1)
status=$?
else
command="remsh $host -l remprt '. /usr/UniQ/print/setup;$command'"
output=$($command 2>&1)
status=$?
fi
#
# check error status
#
if [[ $status != 0 ]]
then
ERROR="MSG: remprt failed [$status]\nCOMMAND: $command\nOUTPUT: $output"
error_routine
fi
live free or die
harry
Live Free or Die
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2002 04:36 AM
09-25-2002 04:36 AM
Re: Nested if statement help
Harry
Thanks for spotting that mate. Really appreciated
Thanks again
Steve
Thanks for spotting that mate. Really appreciated
Thanks again
Steve
take your time and think things through
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP