Sh file under linux execution error: oswatcher_restart.sh: line 13: ./startOSW.sh: Permission denied

See sh performs a content file [@ xxxdb0402 the root dbscripts] More oswatcher_restart.sh # 
! # / Usr / bin / ksh
#export oswdir DF = `| grep mysqllog | awk { '}. 6 Print $'`
Export oswdir = / mysqllog


# PS = `-ef TH | grep $$ -v | grep OSWatcher.sh`
#echo $ TH;


IF [` PS -ef | grep -v grep | grep OSWatcher.sh | WC -l` = "0"]
the then
      $ oswdir CD / OSW
        echo "the begin. 1"
      ./startOSW.sh 60 216
 the else
      echo "OSWatcher IS running"
Fi
Exit


2 execute command sh
[MySQL @ xxxdb0402 dbscripts] $ sh oswatcher_restart.sh 
the begin. 1
oswatcher_restart.sh: Line 13 is: ./startOSW.sh: Permission denied
[MySQL @ xxxdb0402 dbscripts] $ 
[MySQL @ xxxdb0402 dbscripts] $ LL /mysqllog/osw/startOSW.sh 
-rw-r - r-- 1 755 MySQL Sep 2 1609 18:13 /mysqllog/osw/startOSW.sh
read, permissions 755 ah , how could it not be executed?


3 next Google, say they see depends on the previous first column of information, and other information to see rwx


r-- --- --- text file owner read, but not write or performing
r-- r-- --- text file owner and group of users (generally, a main group is the owner of the file where the default) readable
r-- r-- r- - any user can read the text but can not write or execute
rwx r-- r- - text file owner read, write, execute, a group of users and other users only read
rwx rx --- text file owner read, write, execute, is user group read, execute
rwx rx rx text file owner read, write, execute, a group of users and other users read, execute
rw- rw- --- text file readable owner and a group of users, write
rw- rw- r- - text file owner and group of users read, write, read other users
rw- rw- --- text file owner and group of users and read other users can read, write, be careful with this permission
to any user can write to the set, because Member
the chmod [WHO] operator [permission] filename


WHO u is the main file permissions genus g is a group of users rights o a user rights to all other user permissions
         + Permission to increase - is to remove the permissions are set permissions =
         r w is the read access is a write access x execute permission u, g, o for the file owner, group of users, and other user.
 
4 Look at my ll file a result, no x mark, and that is not authorized to perform.
[MySQL @ xxxdb0402 dbscripts] $ ll /mysqllog/osw/startOSW.sh 
-rw-r - r-- 1 755 MySQL 2 Sep 1609 /mysqllog/osw/startOSW.sh 18:13


5 So again given 755 permissions
[root @ xxxdb0402 dbscripts] # chmod 755 /mysqllog/osw/startOSW.sh
[root @ xxxdb0402 dbscripts] # LL /mysqllog/osw/startOSW.sh 
XR---rwxr x 1 755 MySQL Sep 2 1609 18:13 /mysqllog/osw/startOSW.sh
saw, with x designates, that can be executed.


6 execution sh, ok again.
[root @ xxxdb0402 dbscripts] # SH oswatcher_restart.sh 
the begin 1
oswatcher_restart.sh: ./startOSW.sh: / bin / ksh: Bad Interpreter: No SUCH File or Directory
[root @ xxxdb0402 dbscripts] # 


another error, but that's another story.

Guess you like

Origin blog.csdn.net/csdnhsh/article/details/91783859