Monit starts the programs with the same uid as it is running (unless
'uid' or 'gid' options are used). Monit starts programs with restricted
environment - this is most probably the reason why sylph is running when
the script is started by hand and not running whstarted by monit =>
check the environment variables needed).
Martin
so finally with help I got the wrapper to create the pid file.I named the
wrapper sylph and put it in the /etc/init.d/ .The code looks like that :
~~~~~~~~~~~~~~~~~~~
LOG_FILE=/tmp/CM_`date +%d%b%Y%H%M`.log
CM=`which sylpheed-claws`
if [ $? -ne 0 ]; then
echo "Unable to find sylpheed-claws"
exit 1
fi
case $1 in
start)
nohup $CM 1>$LOG_FILE 2>&1 &
echo $! > /tmp/sylpheed.pid
;;
stop)
kill `cat /tmp/sylpheed.pid` ;;
*)
echo "usage: sylpheed {start|stop}" ;;
esac
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I called monit from the terminal, as root, :
monit start sylpheed-claws
returns :
'sylpheed-claws' start : /etc/init.d/sylph
'sylpheed-claws' failed to start
"Monit starts programs with restricted
environment "....I modified monitrc entry to start and stop sylph as root
~~~~~~~~~~
check process sylpheed-claws with pidfile /tmp/sylpheed.pid
group mail
start program = "/etc/init.d/sylph start"
as uid dsl and gid staff
stop program = "/etc/init.d/sylph stop"
as uid root and gid root
#if failed port 25 protocol smtp then restart
#if 5 restarts within 5 cycles then timeout
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
still no go.Same error.
If i run the command from the root shell (/etc/init.d/sylph start) it works
perfect.What did I mixed wrong now?