This forum has been archived. All content is frozen. Please use KDE Discuss instead.

how to make auto backups of a remote folder ?

Tags: None
(comma "," separated)
User avatar
Dimitrios
Registered Member
Posts
659
Karma
0
OS
I have a remote folder that is updated regulary (about once a week)
I have access to this folder via konqueror and the fish protocol
I have a local folder synchronized with dropbox

Once every week i copy the contents of the remote folder to the local folder of dropbox.

Is there a way to do the last action automaticaly ?


«The magic continues...»
http://www.mageia.org
Image
User avatar
google01103
Manager
Posts
6668
Karma
25
lftp and cron?

per man page
DESCRIPTION
lftp is a file transfer program that allows sophisticated ftp, http and other connections to other hosts. If site is specified then lftp will connect to that site otherwise a connection has to be established with the open command.

lftp can handle several file access methods - ftp, ftps, http, https, hftp, fish........


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
Dimitrios
Registered Member
Posts
659
Karma
0
OS
I tried with mget but it does nt work

after i tried with mirror and it works with this command:


Code: Select all
lftp -e mirror fish://username@domain.org:2222/home/www/domain.org/path/to/remote/folder -u username,password


The only incovienant is that it gets all files. Any option that i add after the mirror commande is invalid! i get an error that is an invalid option
"lftp: invalid option -- 'n'"
I would like to add a wildcard to get only this type of files: backup*.gz but it does nt matter so much.


Another thing that happens is that when the command is terminated, in the terminal i am remaining in the remote folder. I putted the command in a script and i added a command 'exit' but after the script is launched i am always connected to the remote folder.

This is the output:

Code: Select all
[dglent@localhost ~]$ ./backup
cd ok, cwd=/home/www/domain.org/path/to/remote/folder
Total: 1 directory, 11 files, 0 symlinks
New: 2 files, 0 symlinks
Modified: 6 files, 0 symlinks
2252739 bytes transferred in 7 seconds (311.6K/s)
lftp username@domain.org:~/www/domain.org/path/to/remote/folder>


Is it a problem that it does nt close the connexion ?

And the script:

Code: Select all
#!/bin/bash
cd /home/dglent/Dropbox/backup/
lftp -e mirror fish://username@domain.org:2222/home/www/domain.org/path/to/remote/folder -u username,password
exit


google01103 wrote:lftp and cron?

After all, i intend to add this script to the ~.kde4/Autostart folder


«The magic continues...»
http://www.mageia.org
Image
User avatar
google01103
Manager
Posts
6668
Karma
25
why do you use FISH? why not scp or ssh?

doesn't the "close" command close the connection?
close [-a]

Close idle connections. By default only with the current server, use -a to close all idle
connections.


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
Dimitrios
Registered Member
Posts
659
Karma
0
OS
You have right, after searching for the "scp" command i finaly have a working script:

Code: Select all
#!/usr/bin/expect
 
set timeout 30
spawn /usr/bin/scp -P 2222 user@domain.org:/home/www/domain.org/path/to/folder/backup*.gz /home/dglent/Dropbox/path/to/backup/

expect {
        "Password:"
       {
          send "my_password\r"
          interact
       }
}



The problem now is that when i run the script in a terminal it works fine, but if i set this script in the autostart scripts from systemsettings the kde session does not work. After login, i cannot launch any application, i have the application icons rebonding and nothing happens. i have to logout with ctrl+alt+backspace, the kmenu does nt responding


«The magic continues...»
http://www.mageia.org
Image
User avatar
google01103
Manager
Posts
6668
Karma
25
2 thoughts

1) add a sleep command before the expect script so that the script doesn't run kde has fully started
2) use kalarm and "any time" option


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
Dimitrios
Registered Member
Posts
659
Karma
0
OS
after many tries, i made a new script bash which runs the script of the backup, in this way it is launched inside a terminal, so KDE accept it, and i add the >/dev/null 2>&1 in the command because i would nt like to see the terminal open on startup.
i think it is ok now
:)


Thanks for the interesting, the patience and for the suggestions as i am not a developer, and i have just found out this functionality


«The magic continues...»
http://www.mageia.org
Image
User avatar
google01103
Manager
Posts
6668
Karma
25
you should look at using Kalarm for these kind of things


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
Dimitrios
Registered Member
Posts
659
Karma
0
OS
i ve never used kalarm, i tried it, but i did nt like the window with the notification, i want the task to be executed in the background, without any notification. After that i did nt understand why it does nt let me to edit the notification (it had the description --Read only--)


«The magic continues...»
http://www.mageia.org
Image
User avatar
google01103
Manager
Posts
6668
Karma
25
you need to use a "command alarm" and in the "command output" section
make sure discard is selected

note: there are 4 types of alarms: command, display, audio and email

you got a notification window because you were using a "display alarm"


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
Dimitrios
Registered Member
Posts
659
Karma
0
OS
ok i see better now, i should spending more time with kalarm, i ignored what it is able to do. We have tools in our system and sometimes we dont know what they can do :)


«The magic continues...»
http://www.mageia.org
Image


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]