I will write down the place where the official document is stuck. → Start the stack automatically on boot
As for the flow, as in the above article, We will use ctlscript.sh, which is Bitnami's application control script.
sudo cp installdir/ctlscript.sh /etc/init.d/bitnami-APPNAME
The points of this article are as follows.
The part that is asked to insert into the script
### 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
Please add this after ** #! / Bin / bash **. If you write it before #! / Bin / bash, As shown below, execution fails at OS startup due to a format error.
$ systemctl status bitnami-APPs.service
● bitnami-APPs.service - LSB: Start daemon at boot time
Loaded: loaded (/etc/init.d/bitnami-APPs; generated)
Active: failed (Result: exit-code) since Tue 2020-07-28 23:21:13 JST; 1min 13s ago
Docs: man:systemd-sysv-generator(8)
Process: 512 ExecStart=/etc/init.d/bitnami-APPs start (code=exited, status=203/EXEC)
Jul 28 23:21:13 on20200516 systemd[1]: Starting LSB: Start daemon at boot time...
Jul 28 23:21:13 on20200516 systemd[512]: bitnami-APPs.service: Failed to execute command: Exec format error
Jul 28 23:21:13 on20200516 systemd[512]: bitnami-APPs.service: Failed at step EXEC spawning /etc/init.d/bitnami-APPs: Exec format error
Jul 28 23:21:13 on20200516 systemd[1]: bitnami-APPs.service: Control process exited, code=exited, status=203/EXEC
Jul 28 23:21:13 on20200516 systemd[1]: bitnami-APPs.service: Failed with result 'exit-code'.
Jul 28 23:21:13 on20200516 systemd[1]: Failed to start LSB: Start daemon at boot time.
If you add it correctly, it will succeed in automatic startup as shown below.
$ systemctl status bitnami-APPs.service
● bitnami-APPs.service - LSB: Start daemon at boot time
Loaded: loaded (/etc/init.d/bitnami-APPs; generated)
Active: active (running) since Tue 2020-07-28 23:24:56 JST; 41s ago
Docs: man:systemd-sysv-generator(8)
Process: 514 ExecStart=/etc/init.d/bitnami-APPs start (code=exited, status=0/SUCCESS)
Tasks: 46 (limit: 682)
Memory: 283.5M
CGroup: /system.slice/bitnami-APPs.service
├─ 569 /bin/sh /opt/bitnami/mysql/bin/mysqld_safe --defaults-file=/opt/bitnami/mysql/my.cnf --mysqld=mysqld.bin --socket=/opt/bitnami/mysql/tmp/my>
├─ 899 /opt/bitnami/mysql/bin/mysqld.bin --defaults-file=/opt/bitnami/mysql/my.cnf --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data >
├─1155 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
├─1169 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
├─1170 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
├─1171 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
├─1172 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
└─1173 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
Jul 28 23:24:18 on20200516 systemd[1]: Starting LSB: Start daemon at boot time...
Jul 28 23:24:48 on20200516 bitnami-APPs[567]: /opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
Jul 28 23:24:56 on20200516 bitnami-APPs[1151]: Syntax OK
Jul 28 23:24:56 on20200516 bitnami-APPs[1150]: /opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
Jul 28 23:24:56 on20200516 systemd[1]: Started LSB: Start daemon at boot time.
Recommended Posts