#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: https://mirrors.slickstack.io/bash/ss-restart-mysql.txt ############################### #### path: /var/www/ss-restart-mysql ############################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Forcefully restarts the MySQL service by using init.d absolute path ################## #### module version: Nginx ############################################################## #### bash aliases: ss restart services mysql, ss restart mysql ##################################### #################################################################################################### ## YOU CAN RUN SS-RESTART FOR AN EASY WAY TO RESTART ALL CORE SLICKSTACK (LEMP) MODULES ## ## THIS DOES NOT INCLUDE ANY CUSTOM UBUNTU PACKAGES THAT YOU MAY HAVE INSTALLED ## ## source ss-config ## source /var/www/ss-config ## source ss-functions ## source /var/www/ss-functions ## BELOW THIS RELIES ON SS-CONFIG AND SS-FUNCTIONS #################################################################################################### #### TABLE OF CONTENTS (SS-Restart-MySQL) ########################################################## #################################################################################################### ## this is a brief summary of the different code snippets you will find in this script ## ## each section should be commented so you understand what is being accomplished ## ## A. Touch Timestamp File ## B. Message (Begin Script) #################################################################################################### #### A. SS-Restart-MySQL: Touch Timestamp File ##################################################### #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## ss_touch "${TIMESTAMP_SS_RESTART_MYSQL}" #################################################################################################### #### B. SS-Restart-MySQL: Message (Begin Script) ################################################### #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## ss_echo "${COLOR_INFO}Running ss-restart-mysql: Forcefully restarts the MySQL service by using init.d absolute path... ${COLOR_RESET}" #################################################################################################### #### SS-Restart-Services-Nginx: Forcefully Restart Nginx ########################################### #################################################################################################### ## this script is using init.d instead of systemd shortcuts to allow for absolute paths ## ## asdf ## restart mysql ## /etc/init.d/mysql restart > /dev/null 2>&1 #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: https://unix.stackexchange.com/questions/370942/do-you-need-to-reload-after-adding-a-rule-in-ufw/370947 ## Ref: http://blog.jonathanargentiero.com/failed-to-restart-mysql-service-unit-mysql-service-is-masked/ ## Ref: https://support.plesk.com/hc/en-us/articles/360021187734-The-service-fails-to-start-on-a-Linux-server-service-is-masked ## Ref: https://jira.percona.com/browse/PS-5226 ## Ref: https://blog.ruanbekker.com/blog/2017/12/09/unmask-a-masked-service-in-systemd/ ## Ref: https://askubuntu.com/questions/992464/version-agnostic-php-fpm-restart ## Ref: https://serverfault.com/questions/189940/how-do-you-restart-php-fpm ## Ref: https://stackoverflow.com/questions/41319291/ufw-blocks-most-ports-until-disabled-and-re-enabled-after-reboot ## Ref: https://www.vultr.com/docs/configure-ubuntu-firewall-ufw-on-ubuntu-18-04 ## Ref: https://askubuntu.com/questions/2075/whats-the-difference-between-service-and-etc-init-d ## Ref: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units ## Ref: https://stackoverflow.com/questions/10193788/restarting-cron-after-changing-crontab-file ## SS_EOF