This is a discussion on Logging in an init.d script within the Linux General forums, part of the Linux Forums category; hello to all, i want to start the EJB app server from an init.d script. It looks like: #!/bin/...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
hello to all,
i want to start the EJB app server from an init.d script. It looks like: #!/bin/sh # # Startup script for JBOSS, # # chkconfig: 2345 95 15 # description: JBoss is an EJB Server # processname: jboss # pidfile: /var/run/jboss.pid # config: /opt/jboss-3.2.2RC2 # logfile: /opt/jboss-3.2.2RC2/log/server.log # # version 1.0 - # version 1.1 - kjenks - Start Tomcat, too # # Source function library. .. /etc/rc.d/init.d/functions # Java dir export JAVA_HOME=/usr/java/jdk1.3.1_08 export JBOSS_HOME=/opt/jboss-3.2.2RC2 export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin # I f YOU NEED SPECIAL CLASSES IN YOUR CLASSPATH # AT STARTUP, ADD THEM TO YOUR CLASSPATH HERE # export CLASSPATH= RETVAL=0 # See how we were called. case "$1" in start) cd $JBOSS_HOME/bin echo -n "Starting jboss daemon: " daemon $JBOSS_HOME/bin/run.sh start RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/jboss ;; stop) echo -n "Stopping jboss daemon: " killproc jboss RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/jboss ;; restart) echo -n "Restarting jboss daemon: " $0 stop sleep 2 $0 start ;; esac After do a . /init.d/jboss start. >Starting daemon jboss nothing else happens. when i start the run.sh from the shell it prints a lot of message on stdin and everything works well. So I tried to use a logfile to see whats wrong. I tried to call: daemon $JBOSS_HOME/bin/run.sh start >/var/log/jboss.log 2>&1 But this does not work. The logfile is empty. How can I do a logging? How does 'daemon' work? There is no man page. THANKS A LOT!! |
|
|||
|
Jürgen Leeb wrote:
> when i start the run.sh from the shell it prints a lot of message on > stdin and everything works well. So I tried to use a logfile to see > whats wrong. > > I tried to call: daemon $JBOSS_HOME/bin/run.sh start >/var/log/jboss.log > 2>&1 > > But this does not work. The logfile is empty. > > How can I do a logging? How does 'daemon' work? There is no man page. > > THANKS A LOT!! "daemon" is not a binary executable. It is a bash function defined in /etc/init.d/functions, which gets sourced in to this script via the line: # Source function library. . /etc/rc.d/init.d/functions If you follow the logic in this function, you'll see that ultimately it starts the command via the "initlog" command: if [ -z "$user" ]; then $nice initlog $INITLOG_ARGS -c "$*" The $INITLOG_ARGS is set to "-q" if $BOOTUP is set to something other than "verbose" in /etc/sysconfig/init (I'm just getting this from the scripts on my system, RH9... your system might be different). Anyway, if you do a man on initlog you'll see that the -q option means do *not* print the program's output. Unless you do something to make the value of $BOOTUP equal to "verbose", the default value for $INITLOG_ARGS is "-q" so you won't see any messages. > After do a . /init.d/jboss start. >>Starting daemon jboss > > nothing else happens. No, it started the daemon. If you do a "ps -eal", I suspect you'll see JBOSS started. It just suppressed the messages from the run.sh script. |