hi,
my problem is that i am calling a script from my perl program.
the script checks wether a particular process is running or not if the process is not running then it should start the process.
the problem here is that the front end logs into backend with a user which does not have the permission to restart the process.
i tried using SU command it prompts me for the password. expect is not installed so was not able to use it. i even tried setting the SUID bit of the script and running the script as
su - user -c "/path/test.sh
here it starts asking for the roots password
the script is:
#!/bin/sh
var1=`ps -ef | grep -v grep | grep ravi | awk '{print $2}'`
echo $var1
if [ -z $var1 ]
then
echo "The Process is Running"
else
xx=`whoami`
echo $xx
cwd=`cd /user/bin`
pwd=`pwd`
echo $pwd
`su - user`
`ravi`
xx=`whoami`
echo $xx
prrestart=`/ravi/admin/KickWatchdog -restart`
echo "You win"
fi
echo $vasr1
echo 'ravi'