Start the stack automatically on boot
NOTE: You will need root account privileges to perform the steps below.
To make the Bitnami stack servers start automatically at boot time, install the ctlscript.sh script as a service. Follow the steps below, replacing the APPNAME placeholder in all the commands that follow with the actual application name.
Debian-like Distributions (Debian, Ubuntu, …)
-
If the stack was installed as the root user, copy the installdir/ctlscript.sh script to the /etc/init.d directory. It’s advisable to rename this script to something more specific, such as bitname-APPNAME. Use the following command:
$ sudo cp installdir/ctlscript.sh /etc/init.d/bitnami-APPNAME
If the stack was installed as a different user, create the script below at /etc/init.d/bitnami-APPNAME, replacing USERNAME with the name of the user account that the stack was installed under:
#!/bin/bash su USERNAME -c "installdir/ctlscript.sh $@"
Then, make the script executable:
$ sudo chmod +x /etc/init.d/bitnami-APPNAME
-
Add or modify the following header lines at the beginning of the /etc/init.d/bitnami-APPNAME script. Remember to update the Provides line to reflect the actual name of the script.
#!/bin/sh ### BEGIN INIT INFO # Provides: bitnami-APPNAME # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable services provided by daemon. ### END INIT INFO
NOTE: These header lines are needed to ensure that the script is compatible with systemd.
-
Add the script to the default runlevels and enable it, following the example below:
$ sudo update-rc.d -f bitnami-APPNAME defaults $ sudo update-rc.d -f bitnami-APPNAME enable
Reboot your system and the servers should start automatically.
To revert the changes, use the commands below:
$ cd /etc/init.d
$ sudo update-rc.d -f bitnami-APPNAME remove
RedHat-like Distributions (Red Hat, Fedora Core, CentOS, Suse, …)
-
If the stack was installed as the root user, copy the installdir/ctlscript.sh script to the /etc/init.d directory. It’s advisable to rename this script to something more specific, such as bitname-APPNAME. Use the following command:
$ sudo cp installdir/ctlscript.sh /etc/init.d/bitnami-APPNAME
If the stack was installed as a different user, create the script below at /etc/init.d/bitnami-APPNAME, replacing USERNAME with the name of the user account that the stack was installed under:
#!/bin/bash su USERNAME -c "installdir/ctlscript.sh $@"
-
Add or modify the following lines at the beginning of the /etc/init.d/bitnami-APPNAME script.
#!/bin/sh # # chkconfig: 2345 80 30 # description: Bitnami services
This will execute the script in runlevels 2, 3, 4 and 5, with priority 80 to start and 30 to stop.
-
Install the script as a service.
$ sudo chkconfig --add bitnami-APPNAME
Reboot your system and the servers should start automatically.
To revert the changes, use the command below:
$ sudo chkconfig --del bitnami-APPNAME