Direkt zum Hauptbereich

VDR Synchronisation

automatisiertes syncen des videorecorder:

vdrsync.sh (siehe anhang)

und das ganze mit anacron täglich angestossen:

ln -s vdrsync.sh /etc/cron.daily/vdrsync.sh


Schöne Bashingtutorial:
http://www.tuxhausen.de/kurs_bash_prog.html
Besseres Tutorial:
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-10.html



Script:

#!/bin/bash
#Programm vdrsync.sh
# Läuft lftp schon?
# &> /dev/null
ps aux grep -c lftp; if [ "$?" -lt "2" ]; then
umask 0000
date >> /home/gemeinsame\ Dokumente/Videorecorder/log.txt
echo "Synchronisation gestartet" >> /home/gemeinsame\ Dokumente/Videorecorder/log.txt
/usr/bin/lftp -u root,l1nux -e "mirror --only-newer --delete --verbose --loop ../var/media/disk-volume-0/video /home/gemeinsame\ Dokumente/Videorecorder/vdrsync && exit" 192.168.0.4 >> /home/gemeinsame\ Dokumente/Videorecorder/log.txt
cp -al /home/gemeinsame\ Dokumente/Videorecorder/vdrsync/. /home/gemeinsame\ Dokumente/Videorecorder/ >> /home/gemeinsame\ Dokumente/Videorecorder/log.txt
chmod -R 770 /home/gemeinsame\ Dokumente/Videorecorder
date >> /home/gemeinsame\ Dokumente/Videorecorder/log.txt
echo "Synchronisation beendet" >> /home/gemeinsame\ Dokumente/Videorecorder/log.txt
else
echo "Ein Prozess mit lftp läuft bereits - breche ab">> /home/gemeinsame\ Dokumente/Videorecorder/log.txt
fi
exit 0

Kommentare

Beliebte Posts aus diesem Blog

Kodi keeps crashing when it is started without connected displays. Sometimes I want to startup my kodi setup for some other reasen and start using kodi later.... then kodi was already closed with some crash log file... :( This script works arround by waiting to start kodi until some hdmi port is connected (modify the grep query to adapt to some other port name). #!/bin/bash # Some programs have issues when run without connected display. E.g. Kodi likes to crash when started without any display connected on my system. # This script starts after some hdmi port is connected. # Depends on xrandr. WARNINGTIMEOUTINSECONDS=840 TIMEOUTINSECONDS=900 POLLINGDURATIONINSECONDS=5 LOGFILE= " $HOME /waitTillHdmiConnected.log" #set start conditions SECONDS=0 triggerTimeoutActions (){      echo   ...

Skript kiddies und SSH

Anzahl an fehlerhaften Logins ausgeben: cat /var/logauth.log | grep invalid | wc -l Für einen Server, der in halbes Jahr im Netz läuft finde ich 68350 Versuche. Ein Auszug von /var/logauth.log Jun 3 00:12:02 uhweb69144 sshd[11470]: Invalid user hilary from 201.147.235.91 Jun 3 00:12:02 uhweb69144 sshd[11470]: reverse mapping checking getaddrinfo for static.customer-201-147-235-91.uninet-ide.com.mx failed - POSSIBLE BREAK-IN ATTEMPT! Jun 3 00:12:02 uhweb69144 sshd[11470]: (pam_unix) check pass; user unknown Jun 3 00:12:02 uhweb69144 sshd[11470]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost= 201.147.235.91 Jun 3 00:12:04 uhweb69144 sshd[11470]: Failed password for invalid user hilary from 201.147.235.91 port 49507 ssh2 Jun 3 00:12:09 uhweb69144 sshd[11530]: Invalid user howard from 201.147.235.91 Jun 3 00:12:09 uhweb69144 sshd[11530]: reverse mapping checking getaddrinfo for static.customer-201-147-235-91.uninet-ide.com.mx failed - POSS...

ffmpeg wrapper for .net and java

Ok. I built a custom ffmpeg wrapper but it was just a dirty hack. it was not encapsulated clean.... it worked but it was just tooo ugly to develop some extension... wrapping looked something like this: THIS DOES NOT WORK it is refactored to death:    class MencoderSharp     {         public static bool mencoder(System.Uri infovdrpath, string ratio, System.Uri destinationpath, BackgroundWorker worker, bool deleteConverted,string audioparameter, string videoparamter, bool testRun, DoWorkEventArgs e)         {             int returncode = 0;             foreach (string sourcepath in Directory.GetFiles(infovdrpath.ToString().Substring(0, infovdrpath.ToString().Length - 9), "0*.vdr"))             {                 Process p = new Process();                 //p.StartInfo.WorkingDirectory = @"C:\whatever";                 p.StartInfo.FileName = @"mencoder.exe";                 // http://msdn.microsoft.com/de-de/library/system.diagnostics.processstar...