Operating System - HP-UX
1833558 Members
3338 Online
110061 Solutions
New Discussion

Re: Script not executing as root.

 
SOLVED
Go to solution
Chirag Parekh
Advisor

Script not executing as root.

I am getting this error message while trying to execute a script from within another script as root.

ksh: /usr/local/bin/alltohold.ksh: cannot execute

The alltohold.ksh is owned by root and below are the permissions. The root's default shell is /sbin/sh

-rwx------ 1 root sys 3560 Apr 22 01:10 alltohold.ksh

Any idea why this is not executing. Also this was working fine in the past.

Thanks.
9 REPLIES 9
Geoff Wild
Honored Contributor

Re: Script not executing as root.

Are both scripts ksh?

#!/bin/ksh

How are you calling it?

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Chirag Parekh
Advisor

Re: Script not executing as root.

both scripts are ksh and the script is called from another script as follows:

su oracle -c $BIN/alltohold.ksh

Thanks.
Denver Osborn
Honored Contributor
Solution

Re: Script not executing as root.

"su oracle -c $BIN/alltohold.ksh"

The script is running as the oracle user not as root. Give oracle execute permission to resolve.

-denver
Geoff Wild
Honored Contributor

Re: Script not executing as root.

There's your answer - oracle does NOT have access to the file.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Paul_481
Respected Contributor

Re: Script not executing as root.

Hi,

By running your script like this:

su oracle -c $BIN/alltohold.ksh

The user oracle is the one that execute the script, give the user oracle the permission to run the script or change the script ownership to oracle.

Regards,
Paul
Cem Tugrul
Esteemed Contributor

Re: Script not executing as root.

Hi,
try to give oracle user permision to execute
this script.
good luck,
Our greatest duty in this life is to help others. And please, if you can't
Geoff Wild
Honored Contributor

Re: Script not executing as root.

BTW - don't know if it was intentional or not - but if you

su oracle
- you won't source oracle's profile - to do so, you need to

su - oracle

Rgds..Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Chirag Parekh
Advisor

Re: Script not executing as root.

Thanks for all the responses. I have changed the permission on the file so that Oracle can execute it.
Chirag Parekh
Advisor

Re: Script not executing as root.

Changed the permission on the script so that Oracle can execute it.