Rohit Bajaj
asked on
getting permission denied error on stopping a service
Hi,
On executing the command : service snippet stop i am getting the following error :
env: /etc/init.d/snippet: Permission Denied
what could be the reason ?
Here is my snippet file :
On executing the command : service snippet stop i am getting the following error :
env: /etc/init.d/snippet: Permission Denied
what could be the reason ?
Here is my snippet file :
#!/bin/bash
# chkconfig: 3 99 99
# description: code snippet app
# processname: snippet
. /etc/rc.d/init.d/functions
prog="flocksnippet"
user="flocksnippet"
start()
{
PATH="$PATH:/bin"
PORT=$(awk -F= '/^PORT=/{print $2}' /root/flockApps.properties)
FLOCK_APPS_CONFIG=$(awk -F= '/^FLOCK_APPS_CONFIG=/{print $2}' /root/flockApps.properties)
cd /opt/flock-snippets/
exec="mvn jetty:run -DFLOCK_APPS_CONFIG=${FLOCK_APPS_CONFIG} -DPORT=${PORT}"
daemon --user=$user $exec &
}
stop()
{
PATH="$PATH:/bin"
echo -n $"Stopping $prog: "
killproc $prog
}
restart()
{
stop
start
}
case "$1" in
start)
$1
;;
stop)
$1
;;
restart)
$1
;;
*)
exit 2
esac
exit $?
The user=flocksnippet is a /sbin/nologin user and the filie snippet is owned by root.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.