Other Cadaver Bash Script to WebDav

Hello,

I am at Pair networks on a FreeBSD server. I need to backup my previously tar.gz databases on a WebDav cloud storage as Yandex Disk or Box.com or 4Shared.

Everything works fine with Putty, command line after command line. I am be able to upload my file on Yandex Disk:

Code:
%cadaver
dav:!> open https://webdav.yandex.com
Authentication required for Yandex.Disk on server `webdav.yandex.com':
Username: MyUserName
Password:
dav:/> put MyFile.sql.gz
Uploading MyFile.sql.gz to `/MyFile.sql.gz':
Progress: [=============================>] 100.0% of 1229518 bytes succeeded.
dav:/> exit
Connection to `webdav.yandex.com' closed.
%

However, my bash script fails to upload my file.

Here is my bash script "criptdav.sh":
Code:
#!/bin/sh

/usr/local/bin/cadaver < datadav
Here is my "datadav" file:
Code:
open https://webdav.yandex.com
MyUserName
MyPassword
put MyFile.sql.gz
exit
Here is Putty screenshot of my bash script:

Code:
%sh scriptdav.sh
dav:!> open https://webdav.yandex.com
Authentication required for Yandex.Disk on server `webdav.yandex.com':
Username: MyUserName
dav:/>
Connection to `webdav.yandex.com' closed.
%

Nota Bene:

I tried with Yandex, Box, 4Shared. Same results: Works command line after command line, but script fails to upload my file.

QUESTION:

What's wrong with my bash script?

Thank you for help!
 
I don't know that program, but it looks a lot like ftp. It might not like to read passwords from redirected input. See if there is something like a .netrc for it. .cadaverrc ? You put the machine, user and password into .netrc and datadav is then just the put command.

Juha

.netrc
Code:
machine webdav.yandex.com
login MyUserName
password MyPassword
chmod 600 .netrc or it might ignore the file.
 
Back
Top