Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
backups
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- backups
backups
17-08-2010 7:56 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I know that I should have done it sooner rather than pray to the great god of backup for forgiveness after the event! Well I think I might have caught this one in time if you can help?
I need to backup all the files I have on the CGI server, some are php but there are a load of uploaded photographs as well. In addition I need to backup the data held in MySQL. The question is what is the best tool for the job. I would have used the SSH login if it was available but since that is no longer an option, any ideas?
I need to backup all the files I have on the CGI server, some are php but there are a load of uploaded photographs as well. In addition I need to backup the data held in MySQL. The question is what is the best tool for the job. I would have used the SSH login if it was available but since that is no longer an option, any ideas?
Message 1 of 5
(1,114 Views)
4 REPLIES 4
Re: backups
20-08-2010 1:00 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi Tony,
I guess backing up the db you'd still do using phpmyadmin export tab at https://mysql.plus.net/
For the rest, no login, but you can run non-interactive shell scripts like
(tar.cgi upload as ascii and set mode 0700 then request in browser) would pack up your foo folder into foo.tar.gz and
would unpack it again. Down/upload and delete using ftp. Not most elegant but works.
Gabe
I guess backing up the db you'd still do using phpmyadmin export tab at https://mysql.plus.net/
For the rest, no login, but you can run non-interactive shell scripts like
#!/bin/bash
echo "Content-type: text/plain"
echo
tar -cvvzf foo.tar.gz foo/
(tar.cgi upload as ascii and set mode 0700 then request in browser) would pack up your foo folder into foo.tar.gz and
#!/bin/bash
echo "Content-type: text/plain"
echo
tar -xvvzf foo.tar.gz
would unpack it again. Down/upload and delete using ftp. Not most elegant but works.
Gabe
Message 2 of 5
(364 Views)
Re: backups
20-08-2010 2:13 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
You could do something like this in a similar vein, but includes the mysql databases and emails the finished file to you.
I've just knocked this up off the top of the head so it might need some tidying and testing, but it should work,
#!/bin/bash
echo "Content-type: text/plain"
echo
# Add in your mysql details here
MYSQL_USER=
MYSQL_PASSWORD=
MYSQL_DATABASE=
# Add in your email address
EMAIL=
BACKUPFILE=backup.tar.gz
DATE=$(date +'%Y-%m-%d')
BOUNDARY=$DATE/backup+++
cd ~
mysqldump --opt -u$MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > $MYSQL_DATABASE.sql
tar -cvf - . | base64 > $BACKUPFILE.base64
rm $MYSQL_DATABASE.sql
cat <<EOF> $BACKUPFILE.head
From: <$EMAIL>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="$BOUNDARY"
This is a multipart message in MIME format.
--$BOUNDARY
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Please find backup.tar.gz attached
--$BOUNDARY
Content-Type: application/octet-stream; name="$BACKUPFILE"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="$BACKUPFILE"
EOF
cat $BACKUPFILE.head $BACKUPFILE.base64 | mailx -s "Daily backup for $DATE" $EMAIL
rm $BACKUPFILE.head $BACKUPFILE.base64
I've just knocked this up off the top of the head so it might need some tidying and testing, but it should work,
Message 3 of 5
(364 Views)
Re: backups
20-08-2010 3:16 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: Ben I've just knocked this up off the top of the head
And remembered to base64 the thing on a Friday afternoon.

Gabe
Message 4 of 5
(364 Views)
Re: backups
22-08-2010 6:18 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Duly deFridayed and tested a bit:
Gabe
#!/bin/bash
echo "Content-type: text/plain"
echo
# Add in your mysql details here
MYSQL_HOST=
MYSQL_USER=
MYSQL_PASSWORD=
MYSQL_DATABASE=
# Add in your email address
EMAIL=
# Select files to backup
# . backs up everything
# or select files and folders
# between quotes, e.g.:
# "mysql_backup.sql wordpress/wp-content/ foo.txt bar/foo.txt"
BACKUPFILE="mysql_backup.sql"
# Nothing more to add
DATE=$(date +'%Y-%m-%d')
cd ~
mysqldump --opt -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > mysql_backup.sql
cat <<EOF> tmpfile.txt
To: $EMAIL
From: $EMAIL
Subject: Backup on $DATE
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=$DATE-backup
--$DATE-backup
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
See attached.
--$DATE-backup
Content-Type: application/x-tgz
Content-Disposition: attachment; filename=backup.tar.gz
Content-Transfer-Encoding: base64
EOF
tar -cvzf - $BACKUPFILE | base64 >> tmpfile.txt
cat <<EOF>> tmpfile.txt
--$DATE-backup--
EOF
cat tmpfile.txt | /usr/sbin/sendmail -t -i
rm tmpfile.txt mysql_backup.sql
echo "Backup sent to "$EMAIL
Gabe
Message 5 of 5
(364 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page