Line 20: |
Line 20: |
| | | |
| | | |
− | curl -f -s -k -b /tmp/sme_cookies -c /tmp/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 /tmp/sme_cookies -F function=desktop-backup -F state=perform \ | + | curl -f -s -k -b ~/.sme_cookies -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> |
| | | |
Line 65: |
Line 65: |
| #!/bin/sh | | #!/bin/sh |
| | | |
− | curl -f -s -k -b /tmp/sme_cookies -c /tmp/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://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 /tmp/sme_cookies -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 && that way the second command will only run if the first succeeds. |
| + | |
| The use of date in the filename will append the day of the month to the filename this will mean that a new backup will be created for every day of the month and overwrite them next month, obviously if the next month has fewer days you may be left with a couple of backups from last month. This process can be enhanced or changed as required. | | The use of date in the filename will append the day of the month to the filename this will mean that a new backup will be created for every day of the month and overwrite them next month, obviously if the next month has fewer days you may be left with a couple of backups from last month. This process can be enhanced or changed as required. |
| + | |
| + | {{Warning box|There are a couple of security consideration that you should consider when using curl. |
| + | |
| + | Firstly, the cookie jar ~/.sme_cookies should not be made world readable otherwise others could use your downloaded cookies. |
| + | |
| + | Secondly, your SME Server username and password will appear on the ps listing momentarily this can be avoided by placing the password in a file and using -F password="<your_password_file" if required.}} |
| | | |
| ===Other Extensions=== | | ===Other Extensions=== |