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

1 察看oswatcher_restart.sh的内容

[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


2 run之后报错

[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


尝试过的解决办法

1 重新安装ksh,还是报一样的错误。

2 直接执行 sh startOSW.sh 60 216 ,也是报一样的错误

3  文件格式的问题,我是从prod上面copy到pc本地的,然后从pc本地copy到测试linux环境的,我删除掉sh文件,直接在prod上面vim,后copy文字出来,贴到test linux环境,执行后还是报一样的错误。


最后,我尝试,将文件内容 startOSW.sh以及startOSW.sh中的首行的 #!/bin/ksh 引用删除掉,再执行bash -x oswatcher_restart.sh,OK,不会再报 /bin/ksh: bad interpreter: Permission denied的错误了。


你可能感兴趣的:(startOSW.sh: ./OSWatcher.sh: /bin/ksh: bad interpreter: Permission denied)