So I am having a bash script in /etc/init.d/ containing this init info:
### BEGIN INIT INFO
# Provides: minio server
# Required-Start: $local_fs $remote_fs $mysql $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 5
# Default-Stop:
# Short-Description: Start minio server that were running during shutdown
# Description: Start minio server that were running during shutdown, wether unexpected or not
### END INIT INFO
because this script needs mariadb to run I put the $mysql in the Required-Start, even though $all should (from my understanding) already asure that mariadb is started, as the header of the mysql file looks like this:
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $named $time
# Should-Stop: $network $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mysql database server daemon
# Description: Controls the main MariaDB database server daemon "mysqld"
# and its wrapper script "mysqld_safe".
### END INIT INFO
so the script is checking whether this deamon is running:
for seconds in {1..60}
do
sleep 1
find_pid=$(ps 'aux'| grep "sql")
pid="${find_pid:5:25}"
stringarray=($pid)
pid=${stringarray[0]}
find_pid=$(ps 'aux'| grep "sql")
pid_two="${find_pid:5:25}"
stringarray=($pid_two)
pid_two=${stringarray[0]}
if [ $pid == $pid_two]; then
break
fi
done
if [[ $seconds == 60 ]]; then
echo "database not started yet" | tee -a /var/www/html/startup.log
fi
But for some reason the database is never started when the script is executed. Somebody got an idea on how to fix that?
EDIT: I have also tried this but even after running update-rc.d YOURAPP defaults as suggested in the link, the database is not started when the script is run.