Operating System - HP-UX
1834456 Members
3001 Online
110067 Solutions
New Discussion

Need actual output of vecheck command

 
SOLVED
Go to solution
Vineet Deshpande
Frequent Advisor

Need actual output of vecheck command

Hi,

I need the actual output of the vecheck command used to identify if a system is vPar or not. Can someone please paste it here??

Thanks,

Vineet
14 REPLIES 14
Torsten.
Acclaimed Contributor

Re: Need actual output of vecheck command

According to this:

vecheck(1):
DESCRIPTION
The vecheck command uses its exit status to report whether or not the
command has been run in a virtual partition (vPars) environment. The
result can be used to alter command flow in a script.
...
RETURN VALUE
The vecheck command exits with one of the following values:

0 The command is run in a vPars environment.
255 The command is run in a non-vPars environment.




it will print nothing to the screen, you need to read the return value.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Vineet Deshpande
Frequent Advisor

Re: Need actual output of vecheck command

Hi Torsten,

Thanks a lot. But if you/anyone do have a vPar setup can you check the output of this command:-

vparstatus -w -M

/sbin/vecheck 1>/dev/null ; echo $?

Thanks,

Vineet

Torsten.
Acclaimed Contributor

Re: Need actual output of vecheck command

Currently I don't have access.

But the echo $? should return either 0 or 255, the other command returns this:

# vparstatus -w
The current virtual partition is myvpar01.

According to the man page

"...

-M Displays attribute and resource information in a machine-
readable format, or restricts output of the -w option to
the name of the local virtual partition.
..."

the result of the following must be the vPar name only


# vparstatus -w -M
myvpar01

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
likid0
Honored Contributor
Solution

Re: Need actual output of vecheck command

[root@sd:~]# vparstatus -w -M
PPDDBB1
[root@sd:~]# /sbin/vecheck >/dev/null ; echo $?
0
Windows?, no thanks
Vineet Deshpande
Frequent Advisor

Re: Need actual output of vecheck command

Hi Daniel,

Thanks a lot for the info. I have 2 questions more for you:-

1) Did you execute the command with superuser or normal?

2) What is the output of the command: /sbin/vecheck

Thanks,

Vineet
Patrick Wallek
Honored Contributor

Re: Need actual output of vecheck command

Daniel executed those commands as root, so super user.

If you read the man page excerpt posted by Torsten it says basically that there is no output generated by vecheck.

You have to look at the exit code to determine whether it's a VPAR or not.
likid0
Honored Contributor

Re: Need actual output of vecheck command

As patrick says, there is no output to the command that's why you do and echo to $?

/sbin/vecheck ; echo $?

EXAMPLES
In a vPars environment:

vecheck
echo $?
0

In a non-vPars environment:

vecheck
echo $?
255
Windows?, no thanks
Vineet Deshpande
Frequent Advisor

Re: Need actual output of vecheck command

Hi Patrick,

I am aware that vparstatus can be executed only by superuser. Does vecheck require superuser or will normal user also be able to execute that command?

Thanks,

Vineet
Patrick Wallek
Honored Contributor

Re: Need actual output of vecheck command

>>I am aware that vparstatus can be executed only by superuser.

But that is not what you asked! You asked **HOW** Daniel executed the commands.

Vineet Deshpande
Frequent Advisor

Re: Need actual output of vecheck command

Hi Patrick,

I apologize. I asked the wrong question. The correct question is:-

Does vecheck require superuser or can a normal user execute the command?

Thanks,

Vineet
Ganesan R
Honored Contributor

Re: Need actual output of vecheck command

Hi Vineet,

Normal user can execute the command. It has execute permission to everyone.

# ll /sbin/vecheck
-r-xr-xr-x 1 bin bin 15648 Oct 8 2003 /sbin/vecheck
#

It is working as normal user also. see below

$ /sbin/vecheck >/dev/null ; echo $?
0
$
Best wishes,

Ganesh.
Vineet Deshpande
Frequent Advisor

Re: Need actual output of vecheck command

Thanks a LOT Ganesan !!
Vineet Deshpande
Frequent Advisor

Re: Need actual output of vecheck command

Hi Ganesan / Daniel,

Can you please run this command on any vPar and let me know the output of the same?

/sbin/vecheck >/dev/null 2>/dev/null ; echo $? | grep "0" 2>/dev/null

Thanks a lot,

Vineet
Viktor Balogh
Honored Contributor

Re: Need actual output of vecheck command

>Can you please run this command on any vPar and let me know the output of the same?

#/sbin/vecheck >/dev/null 2>/dev/null ; echo $? | grep "0" 2>/dev/null
0

though if you're fiddling with some shell script i would recommend you the following:

#!/usr/bin/ksh
/sbin/vecheck
if [ $? -eq ]
then
echo "vPar environment detected!"
else
echo "This is not a virtual partition."
fi

****
Unix operates with beer.