Hallo,
ich möchte 1x am Tag Daten von einem FTP Server auf meinen OMV-Server
laden. Lässt sich das per Cronjob machen?
Gruss
Hallo,
ich möchte 1x am Tag Daten von einem FTP Server auf meinen OMV-Server
laden. Lässt sich das per Cronjob machen?
Gruss
Ist der FTP Server und dein NAS dauerhaft an? Dann einfach ftpfs/curlftps nutzen, und das kopieren der dateien in nen script packen welches du per Cronjob laufen lässt:
http://wiki.ubuntuusers.de/curlftpfs
Ist dein NAS nicht dauerhaft an musst du das Kapitel mit der FSTAB durcharbeiten. Es empfiehlt sich ausdrücklich für die speicherung von User/Passwort netrc zu verwenden wie im o.g. Artikel beschrieben!
Gruß
David
Danke.... Mit etwas fummeln läuft es nun, curlftps hat mich schliesslich zu sshfs geführt, da nur sftp geht.
Habe mir erstmal 3 Cronjobs angelegt, da ich das nicht mit einem Script hinbekommen habe.
Cronjob 1: Mounte sftp Laufwerk
Cronjob 2: Backup Ordner "home"
tar -cf /media/422dadde-c327-4fd2-9ead-bd2227600123/Dokumente/Meteo/home-`date "+%F"`.tar /mnt/meteo/home
Cronjob 3: Backup Ordner "data"
tar -cf /media/422dadde-c327-4fd2-9ead-bd2227600123/Dokumente/Meteo/data-`date "+%F"`.tar /mnt/meteo/data
Per Cronjob geht so, komischerweise nicht per Script
Ich sehe zwar nicht wo das Problem liegt das alles in einen Cronjob zu packen, was vorallem sicher stellt dass das Backup erst startet sobald die Verbindung aufgebaut wurde. Ich empfehle dir aber die Authentifizierung auf Public-Keys umzustellen, so im Klartext ein Passwort in eine Systemdatei eintragen die jeder mit Zugriff auf das System lesen kann ist nicht wirklich sicher.
Siehe: http://wiki.ubuntuusers.de/FUSE/sshfs bzw. http://wiki.ubuntuusers.de/SSH…zierung-ueber-Public-Keys
Or a solution inbetween:
ZitatAlles anzeigenYou can pass user and password on the command line as an option. The "simple" way to do this, is including
-o username=user,password=pass
A more secure, recommended way to do this is to use a credential file. This is a plain text file, stored in a secure directory only readable by yourself. It contains nothing more than
username=yourusername
password=youpass
chmod it to 600 so that it is only readable by yourself (and root).
Suppose the file is $HOME/.credentials
then you use the file on the command line like:
($HOME stands for your home directory and can be typed as such at the command line: it will be "expanded" automatically).
sshfs -o credentials=$HOME/.credentials your-ssh-username@your-web-host.com:remote-directory ~/.remote-secure-volume
ZitatIn /etc/fstab, your line will look like
sshfs#user@server.domain.com:/<your default dir> <mount point> fuse credentials=<path to .credentials>.credentials 0 0
Zitat(you cannot use the $HOME variable, but you need to spell out the full path yourself).
I am not sure about the "encrypt" part: probably you will need to issue this command manually before the transaction, or have it placed in a script.
Source: http://ubuntuforums.org/showth…147&p=5244629#post5244629
°_° :roll: Jetzt verfall ich schon in einem Post von Deutsch ins englische.... grml... hoffe du verstehst das hier drunter trotzdem... :roll:
Should be more secure than using the password in plaintext within a cron.
So, add a credentials file and - either add the line to your fstab for permanent mount - or put it into a new backup script - which should simply look like like that:
#!/bin/sh
# Backupscript fuer 'home' und 'data' auf remote ftp via sshfs/sftp
mounterfolg="Remote FTP Location erfolgreich gemountet!"
mountfehlerhaft="Mounten der Remote FTP location fehlgeschlagen!"
path=/media/422dadde-c327-4fd2-9ead-bd2227600123/Dokumente/Meteo/
# mount remote ftp, nur noetig wenn nicht dauerhaft via fstab eingebunden!
sshfs -o credentials=/home/LOCALUSER/.credentials REMOTEUSER@REMOTEHOST:REMOTEDIR /MOUNT/PUNKT && echo "§mounterfolg" || echo "mountfehlerhaft"
#Backup 'home'
tar -cf '$path'home-`date "+%F"`.tar /mnt/meteo/home
#Backup 'data'
tar -cf '$path'data-`date "+%F"`.tar /mnt/meteo/home
Alles anzeigen
Script ist ungetestet, könnte also noch Syntaxfehler enthalten.
Gruß
David
werde es probieren, danke. das ganze spielt sich eh nur im LAN ab....
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!