How to start a Bitnami stack at boot on Slackware

Bitnami stacks are a sort of self-contained sets of applications that allow you to run server-side software without touching anything on your operating system.

After the installation procedure all the needed stuff is located into a folder which can be also relocated, if necessary.

Bitnami logo
Bitnami logo

In my opinion these kind of tools are very useful when you have to try something on the fly, but also when you have to deal with an important project.

Normally, in both cases an initial configuration is required (for example you need a LAMP bundle). But the stacks let you to literally skip this configuration phase, so you can dedicate yourself to the main activity without any time loss.

Last week I was trying to setup an internal wiki at home and my choice fell to the DokuWiki stack provided by Bitnami.

I already used DokuWiki in the past. It’s very handy because it stores all the information on text files and so it doesn’t require a database. You only need PHP in practice.

After the end of the installation of the stack I needed a way to run automatically the application on startup.

Here you can find some instructions on how to do that. Unfortunately these instructions work well only for Debian-like and RedHat-like distributions. However, there are some hints that you can also use on Slackware!

Starting DokuWiki automatically at boot

At first hand, one could be tempted to simply add a line, like this one below, in /etc/rc.d/rc.local:

./home/<your_user>/<dokuwiki_install_dir>/ctlscript.sh start

What happens if the network is not ready at the time the command here above is launched?

This kind of approach doesn’t work, because we are trying to automatically start an application that needs the network to be up!

The concept is well explained here:

rc.inet2

rc.inet1 gives you a network; rc.inet2 finishes the job of network configuration by running stuff on that network. Any services or daemons that use the network should be started from this file. Most of the rc scripts in charge of starting daemons like inetd, sshd, bind, nfs, etc get called from rc.inet2

This allowed me to solve the problem. I created a simple script called rc.wiki in /etc/rc.d/ giving execution permissions to it (with chmod +x rc.wiki):

#!/bin/bash

wiki_start() {
  su cristiano -c "/home/cristiano/dokuwiki-20180422b-4/ctlscript.sh start"
}

wiki_stop() {
  su cristiano -c "/home/cristiano/dokuwiki-20180422b-4/ctlscript.sh stop"
}

wiki_restart() {
  su cristiano -c "/home/cristiano/dokuwiki-20180422b-4/ctlscript.sh restart"
}

case "$1" in
  'start')
    wiki_start
    ;;
  'stop')
    wiki_stop
    ;;
  'restart')
    wiki_restart
    ;;
  *)
  echo "Usage: $0 start|stop|restart"
esac

Then I added the following lines at the end of /etc/rc.d/rc.inet2:

# Start DokuWiki Bitnami stack
if [ -x /etc/rc.d/rc.wiki ]; then
  /etc/rc.d/rc.wiki start
fi

Now, every time I turn on the PC, after a few seconds I can reach DokuWiki by pointing the browser to the address http://<local_IP_address>:<port>/dokuwiki/.

Note: the default port number used by the Bitnami stack is 8080.

Did you like this post? Share it!
Share on email
Email
Share on twitter
Twitter
Share on facebook
Facebook
Share on linkedin
Linkedin
Share on print
Print

Leave a Reply