Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - boxygen

Pages: [1]
1
Backup / Restore MYSQL Backup from Daily Backup
« on: January 23, 2018, 01:25:54 AM »
I want to restore one of my MYSQL Backup from Daily Backup.

I tried this script http://forum.centos-webpanel.com/backup/(contrib)-restore-backup-scripts-for-web-folder-files-and-mysql-database/?action=post;last_msg=6046

Quote
#!/bin/bash
#
# RESTORE MYSQL BACKUP SCRIPT from central backup repository
# http://centos-webpanel.com
#
# Note: the database must exist before restored
#

# Root folder of backups repository (change accordly)
BACKUPROOT="/backups"

if [[ $# -ne 3 ]]; then
   echo "Usage: restore_mysql -d|-w|-m appanage appanage_mailer"
   echo "       where d=daily, w=weekly, m=monthly"
   echo "Example: restore_mysql -d user1 db1"
   echo "         will restore appanage_mailer mysql database from daily backup repository"
   exit 1
fi

case "$1" in
   -d)
     BACKUPTYPE="daily"
     ;;
   -w)
     BACKUPTYPE="weekly"
     ;;
   -m)
     BACKUPTYPE="monthly"
     ;;
   *)
      echo "Usage: restore_mysql -d|-w|-m appanage appanage_mailer"
      echo "       where d=daily, w=weekly, m=monthly"
      echo "Example: restore_mysql -d user1 db1"
      echo "         will restore user1_db1 mysql database from daily backup repository"
     exit 1
esac

USERNAME=$2
DBNAME=$3
MYSQLPWD=`grep password= /root/.my.cnf|awk -F= {'print $2'}`

# Some validations
if [ ! -e "$BACKUPROOT" ];then
   echo "Error: $BACKUPROOT not exists, cannot restore."
   exit 1
fi
if [ ! -e "$BACKUPROOT/mysql/$BACKUPTYPE" ];then
   echo "Error: $BACKUPROOT/mysql/$BACKUPTYPE not exists, cannot restore."
   exit 1
fi
if [ ! -e "$BACKUPROOT/mysql/$BACKUPTYPE/${USERNAME}_${DBNAME}.sql" ];then
   echo "Error: $BACKUPROOT/mysql/$BACKUPTYPE/${USERNAME}_${DBNAME}.sql not exists, cannot restore it."
   exit 1
fi

# Drop all tables from database
mysqldump -uroot -p"$MYSQLPWD" --add-drop-table --no-data ${USERNAME}_${DBNAME} | grep -e '^DROP \| FOREIGN_KEY_CHECKS' | mysql -uroot -p"$MYSQLPWD" ${USERNAME}_${DBNAME}

# Import mysql backup dump
mysql -uroot -p"$MYSQLPWD" ${USERNAME}_${DBNAME} < $BACKUPROOT/mysql/$BACKUPTYPE/${USERNAME}_${DBNAME}.sql

But I am getting this error

[root@mailer /]# /scripts/restore_db
-bash: /scripts/restore_db: /bin/bash^M: bad interpreter: No such file or directory

I have save the above script in restore_db file and uploaded that file to /scripts folder

Any help is highly appreciated please.

2
CentOS 7 Problems / Apache not running
« on: October 26, 2017, 07:52:14 AM »
When I changed the hostname of my server the apache stopped working.

Now the log is showing following messages

The part of log:

Redirecting to /bin/systemctl restart  httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Oct 26 06:47:08 mailer.boxygen.ml postfix/smtpd[14485]: warning: cannot get RSA certificate from file /etc/pki/tls/certs/mailer.boxygen.ml.crt: disabling TLS s
Oct 26 06:47:08 mailer.boxygen.ml postfix/smtpd[14485]: warning: TLS library problem: 14485:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:70
Oct 26 06:47:08 mailer.boxygen.ml postfix/smtpd[14485]: warning: TLS library problem: 14485:error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM
Oct 26 06:47:08 mailer.boxygen.ml postfix/smtpd[14485]: warning: hostname 161-22-62-2.petrynet.com.br does not resolve to address 161.22.62.2: Name or service


I don't have any SSL Certificate installed but it is giving error due to that.

How to resolve this.

Pages: [1]