LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-19-2005, 03:25 PM   #1
bigsness
LQ Newbie
 
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
Logging with Start stop daemon


Hey,

I wrote a script to start an algorithm on one of my database machines. After some tweaking I have gotten the Start, stop, restart, and reload to function fine. My problem is that with the start stop daemon, the logging of stdout and stderr logs that of SSD, not what I am executing. Is there a way to log the execute commands output? Below is the script to save time in anyone needing to ask. Thanks.

#!/bin/sh

#Script to start and stop algorithm control

NAME=algorithm_control
PIDFILE=/var/run/$NAME.pid

export JAVA_HOME=/usr/share/java/j2sdk1.4.2_05/bin
export CLASS_PATH=/usr/local/digonex/lib
export POSTGRESQL_PATH=/usr/share/java

SSD=`which start-stop-daemon`

export login_name=******
export login_password=******
mapserver_IP="digsecdb"

START="$JAVA_HOME/java"
PARAMETERS="-cp $POSTGRESQL_PATH/postgresql.jar:$CLASS_PATH/AlgorithmControl.jar:$CLASS_PATH/DTISoapClient.jar AlgorithmControl.AlgorithmControl $login_name $login_password $mapserver_IP >> /var/log/algorithm_control.log 2>&1"

case "$1" in
'start')
echo "Starting up the $NAME"

#`$START` >> /var/log/algorithm_control.log 2>&1 &

$SSD --start --make-pidfile --pidfile $PIDFILE --background --exec $START -- $PARAMETERS
;;

'stop')
echo "Stopping the $NAME"
kill -s INT `cat $PIDFILE`
;;

'restart')
echo -n "Restarting $NAME"
kill -s INT `cat $PIDFILE`
sleep 3
i=go

while [ "$i" = go ]
do

ps aux | grep -v restart | grep [a]lgorithm > /root/algorithm_tmp.log

if [ -s /root/algorithm_tmp.log ]; then

sleep 5

else

$SSD --start --make-pidfile --pidfile $PIDFILE --background --exec $START -- $PARAMETERS
i=""

fi

rm /root/algorithm_tmp.log
done
;;

'reload')
echo -n "Reloading Algorithm"
kill -s HUP `cat $PIDFILE`
;;

*)
echo "Usage: /etc/init.d/algorithm {start|stop|restart}"
exit 1
;;
esac

exit 0


Any help on getting this to log the executed command would help me immensly. Thanks a lot.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
start-stop-daemon problems after process crash emarti20 Linux - Software 3 04-15-2005 08:54 AM
How do I stop the sshd daemon? ebenh Linux - Software 5 09-04-2004 01:06 PM
Howto stop daemon from starting Lawful Linux - General 3 04-30-2004 04:06 PM
How do you stop a daemon from starting at bootup?? rberry88 Fedora 6 02-18-2004 01:44 PM
daemon logging- how do I? jimieee Linux - General 1 09-17-2003 09:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration