Run at boot

Hi there :)!

I've set up my own openSuse server and It's working perfectly, but... Some stuff has to be executed at boot, but it won't. I've tried boot.local and init.d but nothing works. This are the things that needs to be execute:

# Free the SSH port
killall xinetd

# Run subversion
svnserve -r /svn -d

# Start Trac (after Apache start)
tracd -p 30 --auth="*",/project/passwd,trac -e /project --daemonize

How can I do this?

I would use the example init.d scripts that come with trac
and one similar to this one for svn server
Note in the trac one the header:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tracd
# Required-Start:    networking
# Required-Stop:     networking
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the tracd standalone Trac web server.
### END INIT INFO
# (C) 2008 Guy Rutenberg <http://www.guyrutenberg.com>

This is very important on SuSE distro's as its used by "insserv" to decide what to start and when. If you add one of these headers to the svn serve init.d script above and save them both to /etc/init.d and tweak their settings for your installation.

Then use "chkconfig -del" to stop the xinetd service from starting (as opposed to using the "killall xinetd" entry - I assume thats what you want)

And then use "chkconfig -add" to enable the other two new scripts, and then run "insserv" it should automatically add the two scripts in at the right levels with the right dependencies.

Use "chkconfig -list" with a grep to display the new services to check they are now enabled, and reboot.

Hopefully this should sort all your startup issues in a nice SuSE way.

I hope this helps...

Hi thanks!! :slight_smile: Subversion does work now, but I can't get Trac to work at startup. I've modified the code and now I have the following:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          tracd
# Required-Start:    
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the tracd standalone Trac web server.
### END INIT INFO
# (C) 2008 Guy Rutenberg <http://www.guyrutenberg.com>
 
set -e
 
. /lib/lsb/init-functions
 
case "$1" in
  start)
	tracd -p 30 --auth="*",/project/passwd,trac -e /project --daemonize
	;;
  stop)
	killall tracd
	;;
  restart|force-reload)
	killall tracd
	;;
esac
 
exit 0

But, trac doesn't work. If I call /etc/init.d/trac start then it's started, but it doesn't start at boot. I did chkconfig --add trac. What can I do now?

What does "chkconfig --list | grep trac" give you ?

This:

trac 0: off 1: off 2: off 3: on 4: off 5: on 6: off

[EDIT]Ahh smileys :stuck_out_tongue:

I editted the script but it still doesn't work :frowning: :

#!/bin/bash
#
#	/etc/rc.d/init.d/trac
#
# Starts the Trac Daemon
#
# description: Trac Daemon

# processname: trac
 
set -e
 
. /lib/lsb/init-functions
 
case "$1" in
  start)
	tracd -p 30 --auth="*",/project/passwd,trac -e /project --daemonize
	;;
  stop)
	killall tracd
	;;
  restart|force-reload)
	killall tracd
	;;
esac
 
exit 0

Hmmm...the header on the init.d/trac says startup on runlevel 2, but the list says it isnt. Do you need to re-run "insserv" ? That should read the header and make the desired changes

Now, I editted trac -> (See last post). The header is changed. But why doesn't it work at boot?
When I re-run insserv, I get this:

insserv: warning: script 'S01trac' missing LSB tags and overrides
insserv: warning: script 'S01subversion' missing LSB tags and overrides
insserv: warning: script 'trac' missing LSB tags and overrides
insserv: warning: script 'subversion' missing LSB tags and overrides

Ah...the header info isnt quite right.
Compare them against one of the existing services that are in /etc/init.d
Make sure the name of the script and the "Provides" line is also correct.
An example of my OpenSuSE headers are:

### BEGIN INIT INFO
# Provides: XXX
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Start the XXX daemon
### END INIT INFO
#

then once your happy re-run "insserv" until the messages disappear.

Cheers

1 Like

Thnx, this is weird. It seems to work, but trac will not start. I added this line in /etc/init.d/trac:

echo "test" > /testlog

After system reboot, the file (/testlog) exists. So /etc/init.d/trac is called. But I can't reach the Trac page! (When I do a "/etc/init.d/trac start" now, I can reach Trac). So something is wrong. Maybe it needs Apache to be started or something? How can I do this?

---------- Post updated at 09:38 AM ---------- Previous update was at 08:59 AM ----------

Thanks!!! :smiley: It works now! I modified the script again:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          tracd
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the tracd web server
# Description:       starts tracd using start-stop-daemon
### END INIT INFO
 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/tracd
NAME=tracd
DESC=tracd
DAEMON_OPTS="-p 30 --auth="*",/project/passwd,trac -e /project --daemonize"
 
test -x $DAEMON || exit 0
 
# Include tracd defaults if available
if [ -f /etc/default/tracd ] ; then
        . /etc/default/tracd
fi
 
set -e
 
case "$1" in
  start)
        echo -n "Starting $DESC: "
        /usr/local/bin/tracd $DAEMON_OPTS
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        killall tracd
        echo "$NAME."
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac
 
exit 0