Ubuntu 12.04 Cronjob failed to mount ftp share using gvfs-mount
Currently I have task to backup some data from ftp server to local pc for every hour in every day.
Say the server is 10.10.10.10 with credentials username and password When I open the ftp server through Firefox it displays root of the ftp user (eg. /home/username), but when I open it through Nautilus it displays root of the ftp server (eg. /). I dont know exactly what OS server is running (I think it is Solaris) and the settings, I just given the credentials. The problem is data that I need to backup is located at the root of the ftp server (eg. /backup), so I have to mount it like Nautilus does. Also I have tried curlftpfs, but it mounts ftp server like Firefox does. I googled and found that to mount ftp server like Nautilus does was using gvfs-mount So I wrote some shell script to automate this task. Here what I got : #!/bin/sh $ftp_user="username" $ftp_pass="password" $ftp_host="10.10.10.10" echo "$ftp_pass" | /usr/bin/gvfs-mount 'ftp://'$ftp_user'@'$ftp_host ftp_dir=$(find "$HOME/.gvfs/" -path "*$ftp_host*" -print -quit) ### Do backup here /usr/bin/gvfs-mount --umount "$ftp_dir" I named the script as backup.sh, added execute bit, run it from Terminal (eg. ./backup.sh), and nothing unexpected was happened. So I added that script to my cronjob (eg. 0 * * * * /home/myusername/backup.sh 2>&1 | /usr/bin/logger -t "TEST_CRONJOB"), but the ftp was not mounted. When I checked the log, the error was : TEST_CRONJOB: Error mounting location: volume doesn't implement mount TEST_CRONJOB: Error finding enclosing mount: Containing mount does not exist So, my question is : Is there something I need to configure before using cron and gvfs-mount ? Thanks in advance |
If you are already logged in, thus I believe gvfs is already mounted. Trying to mount over a mount with gvfs doesn't work as gvfs doesn't support the mount function.
|
Quote:
|
The place you are trying to mount doesn't allow you to mount.
Since all of this appears to be taking place on your local machine, it would be there. |
my opinion is that it would be more secure and easier to use scp with private-key-encryption. there is also sshfs which will mount remote directories using ssh.
|
Quote:
I have chown'd and chgrp'd the the mount point on my local pc. Quote:
Here what I got : #!/bin/sh echo password | /usr/bin/scp username@host:/path/to/some/file /home/myusername I added that script to cronjob and it doesnt work. The report I got : TEST_CRONJOB: Permission denied, please try again.#015 TEST_CRONJOB: Permission denied, please try again.#015 TEST_CRONJOB: Permission denied (publickey,password).#015 When I tried it on Terminal, it seems that echo didnt pipe password to scp. Any ideas? |
Quote:
Quote:
Quote:
|
Quote:
http://linuxproblem.org/art_9.html |
Quote:
Thanks Quote:
|
All times are GMT -5. The time now is 03:46 PM. |