Difference between revisions of "Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up Backup to Remote Server"
(Created page with '{| summary="Navigation header" width="100%" ! colspan="3" align="center" | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up Backup to Remote Server|Advanced Topics…') |
Davidmbrooke (Talk | contribs) m (Navigation link tidyups) |
||
Line 79: | Line 79: | ||
If all is OK, you should see in <code class="filename">/var/log/backup.log</code> string like | If all is OK, you should see in <code class="filename">/var/log/backup.log</code> string like | ||
Mon Jun 20 12:14:42 EEST 2011: Backup successful | Mon Jun 20 12:14:42 EEST 2011: Backup successful | ||
+ | |||
---- | ---- | ||
{| summary="Navigation footer" width="100%" | {| summary="Navigation footer" width="100%" | ||
− | | width="40%" align="left" | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up | + | | width="40%" align="left" | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up Remote Monitoring|Prev]] |
| width="20%" align="center" | [[Bering-uClibc 4.x - User Guide - Advanced Topics|Up]] | | width="20%" align="center" | [[Bering-uClibc 4.x - User Guide - Advanced Topics|Up]] | ||
− | | width="40%" align="right" | [[Bering-uClibc 4.x - User Guide - Advanced Topics - | + | | width="40%" align="right" | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Modifying initrd.lrp|Next]] |
|} | |} | ||
[[Category:Bering-uClibc 4.x]] | [[Category:Bering-uClibc 4.x]] | ||
[[Category:User Guide]] | [[Category:User Guide]] |
Revision as of 14:52, 21 June 2011
Advanced Topics - Setting Up Backup to Remote Server | ||
---|---|---|
Prev | Bering-uClibc 4.x - User Guide | Next |
Contents
Objectives
We assume here that you want to configure automatic backup to remote server.
Backup mechanism is simple and doesn't require specific software. Here is order of operations:
- LEAF box mounts storage and runs tftp server on mountpoint, after - it sends HTTP request to backup server with list of files
- Backup server fetches files from list, and sends answer to LEAF box
- LEAF box stops tftp server and umounts storage
Step 1: Configure Remote Server
You need a remote server with next available software:
- HTTP server
- tftp client
- CGI backup script
Here is sample backup script (it uses atftp as ftp client):
#!/bin/bash # Path to dir where files will be stored REPO="/var/lib/backup" if [ -n "$HTTP_USER_AGENT" ]; then echo "Content-Type: text/html" echo fi if [ -n "`echo $HTTP_USER_AGENT | grep "Wget"`" ] && [ -n "$REMOTE_ADDR" ]; then if [ "$REQUEST_METHOD" = "POST" ] ; then _F_QUERY_STRING=`dd count=$CONTENT_LENGTH bs=1 2> /dev/null` if [ "$QUERY_STRING" != "" ] ; then _F_QUERY_STRING="$_F_QUERY_STRING""&$QUERY_STRING" fi else _F_QUERY_STRING="$QUERY_STRING" fi filelist="${_F_QUERY_STRING//\+/ }" # Create directory for backup in format <IP>/<date> mkdir -p $REPO/$REMOTE_ADDR/`date +%Y%m%d` cd $REPO/$REMOTE_ADDR/`date +%Y%m%d` # Generate commands for tftp client scmd="binary\n" for i in $filelist; do rm -f $i scmd=$scmd"get $i\n" done; # Call tftp client echo -e "$scmd"|atftp $REMOTE_ADDR 2>&1 &>/dev/null # Return result of tftp client execution to LEAF echo $? fi
Step 2: Declare the backup.lrp
and tftpd.lrp
Package
backup.lrp
package has backup script and cron script (/etc/cron.weekly/backup
)
Add the tftpd and backup Package to the LRP list in leaf.cfg
as described in the LEAF Packages Chapter.
Step 3: Configure the backup system
Invoke lrcfg and choose 3) Packages configuration, then backup and then /etc/backup.conf.
Modify string:
MIRROR="http://your.server/path.to.script"
Then - save file and exit from editor.
Step 4: Check if the backup system is working properly
To check if backup functioning properly, run /etc/cron.weekly/backup
.
If all is OK, you should see in /var/log/backup.log
string like
Mon Jun 20 12:14:42 EEST 2011: Backup successful
Prev | Up | Next |