Operating System - HP-UX
1825782 Members
2139 Online
109687 Solutions
New Discussion

Re: it could not use commd "shutdown"

 
SOLVED
Go to solution
study unix
Regular Advisor

it could not use commd "shutdown"

Hi Masters,
it could not use command shutdown as below:
# shutdown -r y 0
sh: shutdown: not found.
so I add shutdown shell into PATH as below, but it is not still used ,

#export PATH=$PATH:/sbin/shutdown

pls see my path environment below,
echo $PATH
/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/ipf/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/usr/bin/X11:/opt/resmon/bin:/opt/perf/bin:/usr/contrib/kwdb/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/graphics/common/bin:/opt/prm/bin:/opt/sfm/bin:/opt/upgrade/bin:/opt/wlm/bin:/opt/ots/bin:/opt/ots/lbin:/opt/sas/bin:/opt/sec_mgmt/bastille/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/firefox:/opt/gnome/bin:/opt/mozilla:/opt/perl_32/bin:/opt/perl_64/bin:/opt/sec_mgmt/spc/bin:/opt/ssh/bin:/opt/swa/bin:/opt/hpsmh/bin:/opt/thunderbird:/opt/gwlm/bin:/usr/contrib/bin/X11:/sbin:/home/root=/usr/sbin/shutdown:/sbin/shutdown

who can give some thread to solve it, thanks!

25 REPLIES 25
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

which user id did u use to execute the shutdown command?

Can you try to use root id to execute the shutdown command?
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi ,
Uid as below:
# who am i
root pts/tc Aug 10 09:18
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

can you try to use full path as follow.

/usr/sbin/shutdown -r y 0
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

or /sbin/shutdown?

Can you post the output

ll /sbin/shutdown and ll /usr/sbin/shutdown
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi,
the full path is the same to fail,
pls see below,

#ll /usr/sbin/shutdown
lrwxrwxr-x 1 root bin 14 Jul 3 23:23 /usr/sbin/shutdown -> /sbin/shutdown
# ll /sbin/shutdown
/sbin/shutdown not found
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

Your /sbin/shutdown file is missing.

can you post the output of ls -ld /sbin?

soandy
Frequent Advisor

Re: it could not use commd "shutdown"

the default setting should be as below:

ls -ld /sbin
dr-xr-xr-x 15 bin bin 8192 Dec 21 2009 /sbin

ll /sbin/shutdown
-r-sr-xr-x 1 root bin 754340 Aug 27 2004 /sbin/shutdown
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi,
# ls -ld
dr-xr-xr-x 31 bin bin 8192 Aug 10 16:41 .

how to solve it ?
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

Hi,

Can you post the output of ls -ld /sbin?
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi,
the same output with yours,
# ls -ld /sbin
dr-xr-xr-x 13 bin bin 8192 Jul 4 01:26 /sbin
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

You have to restore the file from backup. You also need to compare with another server to see any files were removing by someone.
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi ,
Thanks for your reply,
But why I need to do the backup?
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

You need to restore the file /sbin/shutdown from your backup.
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi,
As me understand, I need to backup due to miss the file of /sbin/shutdown, so even if I add its path enviroment the problem is stil exist!
If I can copy it from the other machine ?
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

Yes, you can copy the file from another hp machine. Keep in mine, you have to make sure there is no other files under /sbin are missing. Otherwise, your machine may not be able to boot up. That's why I asked you to check with another machines.

Ensure there is no other files were missing under /sbin.
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi,
Thanks for your nice reminding!
I only need to compare the size with other machine ? if it is ok?
soandy
Frequent Advisor
Solution

Re: it could not use commd "shutdown"

Better check with number of file instead of size only.
soandy
Frequent Advisor

Re: it could not use commd "shutdown"

Good luck
Dennis Handly
Acclaimed Contributor

Re: it could not use commd "shutdown"

>#export PATH=$PATH:/sbin/shutdown

This should have the directory path, not the path to the executable. And your $PATH does have /sbin and /usr/sbin.

>I only need to compare the size with other machine?

Ideally you would compare the checksums with cksum(1). Make sure you copy the permissions and owners when you copy that file.

You can also use "swverify \*" to find other missing files.
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi Soandy,
Thanks for you so nice support!

Hi Dennis,

>#export PATH=$PATH:/sbin/shutdown

This should have the directory path, not the path to the executable. And your $PATH does have /sbin and /usr/sbin.

---I check my $path including /sbin and /usr/sbin as below, and how to understand "This should have the directory path, not the path to the executable"?
please give your support, thanks !


echo $PATH
/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/pe
rl/bin:/opt/ipf/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/usr/b
in/X11:/opt/resmon/bin:/opt/perf/bin:/usr/contrib/kwdb/bin:/opt/wbem/bi
n:/opt/wbem/sbin:/opt/graphics/common/bin:/opt/prm/bin:/opt/sfm/bin:/o
pt/upgrade/bin:/opt/wlm/bin:/opt/ots/bin:/opt/ots/lbin:/opt/sas/bin:/opt/
sec_mgmt/bastille/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/firefox:/opt/gno
me/bin:/opt/mozilla:/opt/perl_32/bin:/opt/perl_64/bin:/opt/sec_mgmt/sp
c/bin:/opt/ssh/bin:/opt/swa/bin:/opt/hpsmh/bin:/opt/thunderbird:/opt/g
wlm/bin:/usr/contrib/bin/X11:/sbin:/home/root=/usr/sbin/shutdown:/sbin/
shutdown
Warren_9
Honored Contributor

Re: it could not use commd "shutdown"

Hi Eyeshot,

please be reminded to assign point if the info is helpful!!.

GOOD LUCK!!
Warren
Dennis Handly
Acclaimed Contributor

Re: it could not use commd "shutdown"

>how to understand "This should have the directory path, not the path to the executable"?

The colon separated components in $PATH must be directories, otherwise they would be ignored.

So these aren't valid:
/home/root=/usr/sbin/shutdown:/sbin/shutdown
study unix
Regular Advisor

Re: it could not use commd "shutdown"

Hi Dennis,
Thanks for your reply, but I feel little confused for PATH,
For example, how to add comand (one full path) to specified enviroment parameter so that I do not need to execute this command with full path, how to do it ?

Thanks again!
Dennis Handly
Acclaimed Contributor

Re: it could not use commd "shutdown"

>>how to add command (one full path) to specified environment parameter so that I do not need to execute this command with full path?

If your command is in directory /abc/DIR, you use:
PATH=$PATH:/abc/DIR