monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: permision problem?


From: Jan-Henrik Haukeland
Subject: Re: permision problem?
Date: Sat, 13 Jan 2007 13:59:59 +0100

On 13. jan. 2007, at 05.33, gabev wrote:

I replaced the lines but still is no go.

I believe is a permission problem ; in that chain , monit ,which calls the
wrapper (sylph as I name it) , which in turn calls the program
sylpheed-claws , the permissions gets screwed somehow;
i guess i have to look deeper.

Look, I have modified your script a bit and added debug trace using 'set -vx'. If you run the script from the console you should be able to see if and where it fails. If you see the text "Error: Should not come here!" then you need to investigate the program 'sylpheed-claws' since it puts itself in the background which will mess up the pid- file monit checks.

Alternatively you can grab the pid of sylpheed-claws by replacing the start) block below with the following, assuming 'sylpheed-claws' is the name of the process

$CM &;
sleep 2;
ps -aef|grep sylpheed-claws| \
awk 'BEGIN{x=1000000;}{if($2<x)x=$2;}END{print x > "/tmp/ sylpheed.pid";}';;

------------------8<-----------
#!/bin/bash
set -vx # print debug info
export DISPLAY=localhost:0.0
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)  
        echo $$ > /tmp/sylpheed.pid ; # /var/run/sylpheed.pid is better
        exec 2>&1 1>$LOG_FILE $CM ;
        echo "Error: Should not come here!" ;;
stop)
        kill `cat /tmp/sylpheed.pid` ;;
*)
        echo "usage: sylpheed {start|stop}" ;;
esac
------------------8<-----------


Best regards
--
Jan-Henrik Haukeland
http://tildeslash.com/








reply via email to

[Prev in Thread] Current Thread [Next in Thread]