Webdav (Web-based Distributed Authoring and Versioning) is a set of methods based on the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers.This can be useful to allow backing up of data between servers. In Linux there is a command line client called cadaver that in theory allows you to script its use.
This isnt as staight forward as it could have been and we spent half a day and a lot of Googling to get to the bottom of common problems, Such as auto loging in, Untrusted ssl certificates and scripting.
So here is a simple run down on what you have to do to script with webdav and cadaver
Install cadaver
yum install cadaver
once installed you will need to install the certificate for the untrusted ssl site
for example
wget http://website/untrusted.server.com.cer
now convert this to a .pem file
openssl x509 -inform der -in untrusted.server.com.cer -out untrusted.server.com.pem
now add this to your cert.pem file.
in centos this seems to be in the /usr/share/ssl/ directory
cat untrusted.server.com.pem >> /usr/share/ssl/cert.pem
you now need to edit the ./netrc file with the server and logon details
vi ~/.netrc
machine untrusted.server.com
login user
password secret
save the file.
now when you connect you wont be promted for accepting the certificate or a username and password
cadaver -et https://untrusted.server.com
dav:/>
Ok now we want to script the actions.
This is as simple as creating a script file.
for example
vi ~/.cadavscript
ls
pwd
quit
will give the following output
cadaver -et https://untrusted.server.com/ < ~/.cadavscript
dav:/> Listing collection `/’: succeeded.
test.txt 35 Aug 19 15:04
dav:/> Current collection is `https://untrusted.server.com/’.
dav:/> Connection to `untrusted.server.com’ closed.
So create a script to do what you want and your done