Jump to content

Edit History

MaXi32

MaXi32

I'm writing the script to put all website in maintenance mode. The bash script is dynamic so it will identify which user to put into maintenace mode, using sql statement is not good here to identify which web_user. So if there is a way like using file based maintenance mode (like wordpress) I really like to know this:     

  #web_user="userwordpress"

        #web_domain="mywsite.com"
        #web_sub_folder="www"
        #web_type="wordpress"
        #maintenance_status=1 #1 = on, #0 = off

       web_user="userprestashop"

       web_domain="mypssite.com"
        web_sub_folder="www"
        web_type="prestashop"
        maintenance_status=1 #1 = on, #0 = off



        if [ $maintenance_status == 1 ]; then
                if [ "$web_type" == "wordpress" ]; then
                        echo "[$script_name | info]: Turning on server maintenance mode for user $web_user" | tee -a $REPORT_FILE
                        maintenance_file="/home/$web_user/domains/$web_domain/public_html/$web_sub_folder/.maintenance"
                        if [ -f $maintenance_file ]; then
                                echo "[$script_name | info]: OK, the website of $web_domain is already in a maintenance mode" | tee -a $REPORT_FILE
                        else
                                touch $maintenance_file
                                echo "# AUTO GENERATED BY MAXIRSYNC BACKUP CRON" >> $maintenance_file
                                echo "<?php" >> $maintenance_file
                                echo "$upgrading = time();" >> $maintenance_file
                                echo "?>" >> $maintenance_file
                                chmod 644 $maintenance_file
                                chown $web_user:$web_user
                                echo "[$script_name | info]: OK, the website of $web_domain is now under maintenance mode" | tee -a $REPORT_FILE
                        fi
                fi
                if [ "$web_type" == "prestashop" ]; then
                        # Prestashop put maintenance mode
                fi
        else # maintenance status = 0
                if [ "$web_type" == "wordpress" ]; then
                        if [ -f $maintenance_file ]; then
                                rm -f $maintenance_file
                        fi
                else
                        # Prestashop put back live mode
                fi
        fi

 

MaXi32

MaXi32

I'm writing the script to put all website in maintenance mode. The bash script is dynamic so it will identify which user to put into maintenace mode, using sql statement is not good here to identify which web_user. So if there is a way like using file based maintenance mode (like wordpress) I really like to know this:

        #web_user="userwordpress"

        #web_domain="mywsite.com"
        #web_sub_folder="www"
        #web_type="wordpress"
        #maintenance_status=1 #1 = on, #0 = off

       web_user="userprestashop"

       web_domain="mypssite.com"
        web_sub_folder="www"
        web_type="prestashop"
        maintenance_status=1 #1 = on, #0 = off

 

        if [ $maintenance_status == 1 ]; then
                if [ "$web_type" == "wordpress" ]; then
                        echo "[$script_name | info]: Turning on server maintenance mode for user $web_user" | tee -a $REPORT_FILE
                        maintenance_file="/home/$web_user/domains/$web_domain/public_html/$web_sub_folder/.maintenance"
                        if [ -f $maintenance_file ]; then
                                echo "[$script_name | info]: OK, the website of $web_domain is already in a maintenance mode" | tee -a $REPORT_FILE
                        else
                                touch $maintenance_file
                                echo "# AUTO GENERATED BY MAXIRSYNC BACKUP CRON" >> $maintenance_file
                                echo "<?php" >> $maintenance_file
                                echo "$upgrading = time();" >> $maintenance_file
                                echo "?>" >> $maintenance_file
                                chmod 644 $maintenance_file
                                chown $web_user:$web_user
                                echo "[$script_name | info]: OK, the website of $web_domain is now under maintenance mode" | tee -a $REPORT_FILE
                        fi
                fi
                if [ "$web_type" == "prestashop" ]; then
                        # Prestashop put maintenance mode
                fi
        else # maintenance status = 0
                if [ "$web_type" == "wordpress" ]; then
                        if [ -f $maintenance_file ]; then
                                rm -f $maintenance_file
                        fi
                else
                        # Prestashop put back live mode
                fi
        fi
 

×
×
  • Create New...