Changes

Jump to navigation Jump to search
Updated for SME Server 9 and correct quoting of passwords
Line 1: Line 1:  
===Introduction===
 
===Introduction===
   −
This HowTo describes a simple way to backup your SME Server remotely using cURL and requires no changes to your SME Server. Further, cURL requires no user interaction and can be scripted or automated using cron to perform regular backups.
+
This HowTo describes a simple way to backup your SME Server remotely using cURL and requires no changes to your SME Server. Further, cURL requires no user interaction and can be scripted or automated using cron to perform regular backups. If the file system the backup is sent to is large file enabled (not DOS) this is also a fairly reliable way to get a desktop style backup > 4GB.
 +
 
 +
The following is updated, tested and confirmed for SME Server 9
    
===Pre-Requisites===
 
===Pre-Requisites===
Line 19: Line 21:  
These two actions map to the following cURL commands:
 
These two actions map to the following cURL commands:
 
   
 
   
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F "username=admin" -F "password=your_password" \
+
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F username='admin' -F password='your_password' \
 
         <nowiki>https://your_sme_server/server-common/cgi-bin/login</nowiki>
 
         <nowiki>https://your_sme_server/server-common/cgi-bin/login</nowiki>
 
   
 
   
  curl -f -s -k -b ~/.sme_cookies -F function=desktop-backup -F state=perform \
+
  curl -f -s -k -b ~/.sme_cookies -H 'Expect:' -F function=desktop-backup -F state=perform \
 
         <nowiki>https://your_sme_server/server-manager/cgi-bin/backup > backupfile.tar.gz</nowiki>  
 
         <nowiki>https://your_sme_server/server-manager/cgi-bin/backup > backupfile.tar.gz</nowiki>  
 
Where:
 
Where:
Line 45: Line 47:  
* -c <cookies> Save cookies here, this is where it stashes your login credentials between step 1) and 2)
 
* -c <cookies> Save cookies here, this is where it stashes your login credentials between step 1) and 2)
 
* -F Fill in form field
 
* -F Fill in form field
 +
* -H This is used to set the HTML Expect: header to blank, was not required prior to SME Server 9
 
* <url>
 
* <url>
   Line 64: Line 67:  
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F username=admin -F "password=<~/sme_password" \
 
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F username=admin -F "password=<~/sme_password" \
 
         <nowiki>https://snoopy/server-common/cgi-bin/login</nowiki> && \
 
         <nowiki>https://snoopy/server-common/cgi-bin/login</nowiki> && \
  curl -f -s -k -b ~/.sme_cookies -F function=desktop-backup -F state=perform \
+
  curl -f -s -k -b ~/.sme_cookies -H 'Expect:' -F function=desktop-backup -F state=perform \
 
         <nowiki>https://snoopy/server-manager/cgi-bin/backup > /home/smebackup/sme-snoopy-`/bin/date +\%d`.tgz</nowiki>
 
         <nowiki>https://snoopy/server-manager/cgi-bin/backup > /home/smebackup/sme-snoopy-`/bin/date +\%d`.tgz</nowiki>
 
In this script we have combined the two curl commands via an && so that the second command will only run if the first command succeeds.
 
In this script we have combined the two curl commands via an && so that the second command will only run if the first command succeeds.
Line 99: Line 102:  
  curl -s -k -x stargate:3128 -b ~/.sme_cookies -c ~/.sme_cookies -F username=admin \
 
  curl -s -k -x stargate:3128 -b ~/.sme_cookies -c ~/.sme_cookies -F username=admin \
 
         -F "password=<~/sme_password" <nowiki>https://snoopy/server-common/cgi-bin/login</nowiki> && \
 
         -F "password=<~/sme_password" <nowiki>https://snoopy/server-common/cgi-bin/login</nowiki> && \
  curl -f -s -k -x stargate:3128 -b ~/.sme_cookies -F function=desktop-backup -F state=perform \
+
  curl -f -s -k -x stargate:3128 -b ~/.sme_cookies -F function=desktop-backup -H "Expect:" -F state=perform \
 
         <nowiki>https://snoopy/server-manager/cgi-bin/backup > /home/smebackup/sme-snoopy-`/bin/date +\%d`.tgz</nowiki>
 
         <nowiki>https://snoopy/server-manager/cgi-bin/backup > /home/smebackup/sme-snoopy-`/bin/date +\%d`.tgz</nowiki>
    
----
 
----
 
[[Category:Howto]] [[Category:Backup]]
 
[[Category:Howto]] [[Category:Backup]]
35

edits

Navigation menu