FOGBackup.sh SQL server address error
I’m trying to run the FOGBackup.sh script, which has worked for me countless times in the past, but it’s now giving me a weird error:
Backing up MySQL database................................mysqldump: Got error: 2005: Unknown MySQL server host '\'127.0.0.1\'' (0) when trying to connect Failed!
I’ve tried replacing the IP with that of my server, but it’s not working. Restarted mysql, no joy. It looks like it may be passing the slashes and single quotes? I dunno. If anyone has any ideas I’m all ears. Thanks.
Running Ubuntu 14.04
@Neil-Underwood you need to update your tree
So when trying to run your new backup script I’m running into an error right off the bat. I’m assuming it’s because of a version mismatch. the file “…/…/lib/common/utils.sh” does not exist on my system. I’m on version 7084.
Wow, it looks like you just rewrote the entire thing. Thanks for taking the time to look into this!
@Tom-Elliott Ah, thanks for that. I’ll go grab it and check it out.
OK so it’s working for me now. I lied about getting back to work, lol. I forgot about the no_root_squash on my NFS export. My new export looks like this:
Additionally, I removed the trailing directories on lines 58, 62, and 65, so they now look like this:
[[ -d $IMAGEDIR/ ]] && cp -auv $IMAGEDIR/ $backupdir/ || false errorStat $? echo "Done" dots " * Backing up snapins" [[ -d $SNAPINDIR/ ]] && cp -auv $SNAPINDIR/ $backupdir/ || false errorStat $? dots " * Backup up reports" [[ -d $REPORTDIR/ ]] && cp -auv $REPORTDIR/ $backupdir/ || false
This eliminated the duplicate directory in the folder structure. I think it’s back to normal now. Not sure how or why it changed.
Hope this was helpful.
@Neil-Underwood Likely because you would need to run as sudo user or as the user who owns the files. THat said, I’ve updated the backup script. I have NOT tested it, so please test and let me know of any issues.
Hmmmm… So I got it working, kinda. I just removed the single quotes and escape characters on line 54:
mysqldump -h"$MYSQL_HOST" -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" --allow-keywords -f $MYSQL_DATABASE > $backupdir/mysql/fog.sql
That got me past the initial hurdle. The problem now seems to be NFS related (tried with -o nfsvers=3 as well). the cp -au command is reporting:
* * Backing up images........................................cp: failed to preserve ownership for ‘/mnt/fog_backup/images/images/lost+found’: Operation not permitted cp: failed to preserve ownership for ‘/mnt/fog_backup/images/images/Optiplex301064bit/d1.mbr’: Operation not permitted cp: failed to preserve ownership for ‘/mnt/fog_backup/images/images/Optiplex301064bit/d1p1.img’: Operation not permitted
Plus, now that I’m looking at it, it’s injecting an extra “images” in the folder structure. ( I think I see why it’s doing this in lines 58, 62, and 65 )
Anyway, that’s where I’m at. I need to get back to work, so I’ll revisit it in a bit. Maybe this helps
LOL sorry to be the oddball! This script works great in a cron job for a quick & easy backup!
I’ll be honest, I wasn’t aware anybody even used that script. Give me a bit, probably tomorrow, and I hope I’ll have that script back to operational.