Skip to content

bash function to sync to and from a remote host by using rsync and ssh

I quickly created two bash functions to use rsync and ssh for syncing directories from the local host to a remote host and vice versa.

The two methods are available on my shell function repository. The two methods are called net_bazzline_sync_from_host and net_bazzline_sync_to_host. Enjoy it :-).

####
# Uses rsync with ssh to copy data from remote to local host
#
# @param string $1 - remote user
# @param string $2 - remote host
# @param string $3 - source path on remote host
# @param string $4 - destination path on local host
#
# @author stev leibelt 
# @since 2013-07-05
####
function net_bazzline_sync_from_host ()
{
    if [[ $# -eq 4 ]]; then
        USER="$1"
        HOST="$2"
        SOURCE="$3"
        DESTINATION="$4"
    else
        echo 'invalid number of variables provided'
        echo 'command user host source destination'
    fi

    rsync -avz -e ssh $USER@$HOST:$SOURCE $DESTINATION
}

####
# Uses rsync with ssh to copy data from local to remote host
#
# @param string $1 - remote user
# @param string $2 - remote host
# @param string $3 - source path on local host
# @param string $4 - destination path on remote host
#
# @author stev leibelt 
# @since 2013-07-05
function net_bazzline_sync_to_host ()
{
    if [[ $# -eq 4 ]]; then
        USER="$1"
        HOST="$2"
        SOURCE="$3"
        DESTINATION="$4"
    else
        echo 'invalid number of variables provided'
        echo 'command user host source destination'
    fi

    rsync -avz -e ssh $SOURCE $USER@$HOST:$DESTINATION
}

web - Die Energie- und Klimawochenschau: Von sinkenden Börsenpreisen, steigenden Verbraucherpreisen und den Kraftwerksplänen der Union

[...] Dieser Erfolg der Erneuerbaren drückt einerseits wegen des Überangebots den Börsenpreis für Strom, was den industriellen Großabnehmern zugutekommt. Andererseits erhöht er damit aber auch die Umlage. Die Netzbetreiber bekommen nämlich die Differenz aus der im Erneuerbare-Energiengesetz (EEG) fixierten Vergütung, die sie den Anlagenbetreibern zahlen müssen, und dem Preis, den sie für den Strom an der Börse erzielen, erstattet. Gezahlt wird das Geld aus einem Fonds, der mit der EEG-Umlage gefüllt wird. Je niedriger also der Preis an der Leipziger Strombörse, desto mehr bekommen die Netzbetreiber aus dem großen Topf. Dadurch wirkt die EEG-Umlage effektiv auch als Umverteilung von den privaten Verbrauchern, die sie zahlen müssen, zu den energieintensiven Großbetrieben, die von der Umlage weitgehend ausgenommen sind, aber über die niedrigen Strompreise an der Börse von dem Erfolg der erneuerbaren Energieträger profitieren. Dieser Konstruktionsfehler der EEG-Umlage ist hier und anderswo schon des Öfteren und in aller Ausführlichkeit diskutiert worden und sicher auch dem Bundesumweltminister bekannt. Dass er dennoch die Debatte um die EEG nutzen will, um den Ausbau der Solar- und jetzt auch der Windenergie zu deckeln, zeigt, dass es ihm um etwas anderes geht: Das Geschäftsfeld der Stromkonzerne, das heißt die Produktion in Großkraftwerken, darf nicht zu sehr eingeschränkt werden. Das Wahlprogramm der Union spricht sich sogar für den beschleunigten Neubau von Kohlekraftwerken aus, für die ein entsprechender Rahmen geschaffen werden solle. Gemeint ist damit ausdrücklich auch die Braunkohle. [...]
Quelle

Ob unsere Agenda2010-Lobbyklitsche das anders handhaben würde, wenn sie am Ruder wäre, möchte ich nicht erörtern. Ich denke das bei diesem Thema auch noch ein Mittel hilft, viele kleine Dateien, damit die Lobby wirklich überlegen muss, in wem sie investiert. Der Stadt unternimmt an diesem Designfehler ja aus zwei Gründen nichts, zum einen läuft das mit den Energiekonzernen einfach zu gut in die eigene Tasche und zum anderen verdient der Staat an jeder Preiserhöhung wenigst 19 Prozent mit.

First Impression Of RaspberryPi

General

So after a while of borrowing multiply pi's, i've managed to buy one. Of course the shipment was delayed so it arrived at a week full of no time. Finally, i prepared all and started the installation, of course an arch linux (like the guy in the advertisement, "what else?" ;-)). The installation was quite easy, i struggeld a bit with the resizing of my partitions. The magic hint, resizes the extended partition first, then you are able to resize the root partition and everything is fine.

After that, i've browsed through the available packages and started setting up the tiny beast. Writing about window managers is a short one, don't do fancy stuff. Notion is working, openbox and fluxbox also. Of course xbmc is running like a charm. But xfce4 and lxde are a bit to much for the little arm. Kde is working better than expected but like chromium, it is far away from running smooth. A nice howto about installing xfce4 on arm arch linux can be found here. Some general beginner tutorials about different raspberry pi distributions can be found here.

What about using known software? Well, you can but keep in mind, it is an arm cpu under the hood. Midori is currently my first choice for browsing the web. If i need something with a gui, pcmanfm is performing well on the pi. Have some minutes left? Read this nice introduction about the desktop world of the raspberry pi.

Other Operation Systems Then Linux

Talking about the upcomming and possible shooting star firefox os, i can only write that i havn't tried it so far. There is a bunch of tutorials out there, like this, that. A list of possible alternative operation systems for the pi can be found here.

What To Do Now?

Well, first i want to try out the media center suitability of the little pi. I like the idea to control the xbmc via an android mobile. I also want to compare xbmc with openELEC. And for the far away future, i want to build zfs on linux on this little box (why?, of course because i can :-D). A git server is also and always an option, lets see. Privoxy, openVPN, tor, the list is getting longer the more i think about it :-).

List Of Links