0

当我以 root 用户身份执行 shell 脚本时,它可以完美执行,但是当我以普通用户(而不是 root)身份执行 shell 脚本时,shell 脚本会连续执行。是root用户还是普通用户决定shell Script的执行?

#!/bin/sh

s=$1      

pro=`ps -ef | grep $s | grep -v grep | grep -v test3.sh | wc -l`

if [ $pro -eq 0 ] 
then
        echo "Service $s is DOWN..."
        echo "Service $s is DOWN..." >> processlogs.txt
        echo "Starting Service $s..."
        echo "Starting Service $s..." >> processlogs.txt
        java -jar clientApplication.jar $s &

else
        echo "Service $s is Running..."
        echo "Service $s is Running..." >> processlogs.txt

fi
4

0 回答 0