Init Script

view full story

http://forums.opensuse.org – Hi, I manually installed tomcat5 on my server and want it to start directly after booting. I wrote a short Init-script for that: #!/bin/sh ### BEGIN INIT INFO # Provides: tomcat # Required-Start: $network $syslog $remote_fs # Should-Start: $named $syslog $time # Required-Stop: $network $syslog # Should-Stop: $named $syslog $time # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Tomcat Servlet Container # Description: Start Tomcat to allow JAVA server pages ### END INIT INFO # rc.status . /etc/rc.status rc_reset # Variables # Java JAVA_HOME="/etc/alternatives/jre" JRE_HOME="/etc/alternatives/jre" # Tomcat CATALINA_BASE="/srv/apache-tomcat-5.5.27" CATALINA_HOME="/srv/apache-tomcat-5.5.27" JASPER_HOME="/srv/apache-tomcat-5.5.27" CATALINA_TMPDIR="/srv/apache-tomcat-5.5.27/temp" case "$1" in start) echo "Starting Tomcat 5.5.27" /srv/apache-tomcat-5.5.27/bin/startup.sh rc_status -v ;; stop) echo "Shutting down Tomcat 5.5.27" /srv/apache-tomcat-5.5.27/bin/shutdown.sh rc_status -v ;; restart) $0 stop echo "Waiting 5s ..." $0 start rc_status ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac rc_exit It's located in /etc/init.d After that I created a symbolic link to /usr/sbin/rctomcat5 Then I used insserv to activate the script and set the runlevels to 3 and 5 via YAST Unfortunately after rebooting the system I get an error that there must be a least one java environment variable set. Where do I have to set the variable (I though I just have to set them in the script) Can any help me find a solution BTW: The script works fine after booting using the console (Distributions)