startOSW.sh: ./OSWatcher.sh: /bin/ksh: bad interpreter: Permission denied

View oswatcher_restart.sh of Contents 1

[root@xxdb0402 dbscripts]# more oswatcher_restart.sh 

#!/bin/ksh
#export oswdir=`df |grep mysqllog|awk {'print $6}'`
export oswdir=/mysqllog
#th=`ps -ef|grep -v $$|grep OSWatcher.sh`
#echo $th;
if [ `ps -ef|grep -v grep|grep OSWatcher.sh|wc -l` = "0" ]
then
      cd $oswdir/osw
        echo "begin 1"
      sh startOSW.sh 60 216
 else
      echo "OSWatcher is running "
fi
exit

 

After 2 run error

[root @ xxdb0402 dbscripts] # bash -x oswatcher_restart.sh 
+ export oswdir = / mysqllog
+ oswdir = / mysqllog
++ ps -ef
++ grep -v grep
++ grep OSWatcher.sh
++ wc -l
+ '[' 0 = 0 ']'
+ cd / mysqllog / OSW
+ echo 'begin 1'
begin 1
+ sh startOSW.sh 60 216
+ exit

[root@xxdb0402 dbscripts]# startOSW.sh: ./OSWatcher.sh: /bin/ksh: bad interpreter: Permission denied

 

Tried solutions

Error 1 Reinstall ksh, or reported the same.

2 direct execution sh startOSW.sh 60 216, also reported the same mistakes

Question 3 file format, I copy from prod above to pc local, then from pc local copy to test linux environment, I deleted sh files directly vim, after the copy text prod above it, paste it into the test linux environment after execution or reported the same mistakes.

 

Finally, I tried, as well as the contents of the file startOSW.sh startOSW.sh in the first line of # / bin / ksh references deleted, then execute bash -x oswatcher_restart.sh, OK, will not be reported to / bin / ksh!: bad interpreter: Permission denied mistake.

Guess you like

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