Little Backup-Script for Linux users
Here is a little easy backup-script for Linux users:
!/bin/bash
chmod +x des Skripts
crontab -e
everyday at 12:00
10 * * * * "/Zielverzeichnis/tsk_backup.sh daily" >/dev/null 2>&
every Monday at 13:00pm
0 13 /7 * 1 "/Zielverzeichnis/tsk_backup.sh weekly" >/dev/null 2>&
every 1st in month at 12:30pm
30 12 * 1 1 "/Zielverzeichnis/tsk_backup.sh monthly" >/dev/null 2>&
baseDir="/yourFolderGoesHere"
if [ $1 ]; then
if [ $2 ]; then
sourcePath=$baseDir/$2.tsk
fileName=$2
else
sourcePath=$baseDir/Track.tsk
fileName=Track
fi
if [ ! -d $baseDir/$1 ]; then
mkdir $baseDir/$1
fi
cp $sourcePath $baseDir/$1/$(date +%y%m%d%H%M)$fileName.tsk
kdialog --title "Backup Taskcoach" --msgbox "Track $1 ($2) saved to $baseDir/$1/ "
else
echo "
Parameter daily | weekly | monthly
Optionaly use 2. Parameter for Filename (without Filetype)"
fi
There is already an option for automatic-backup in the preferences, although that backs up on every save. Perhaps a better request would be to make that simply time-based such as every 15 minutes (if you’d like that, add a feature request for that). Otherwise, backup via any existing backup option obviously works whether that is a script, a program like BackInTime or a tool like SpiderOak/UbuntuOne/Dropbox/etc.
-
McGinnis commented
Once your files are deleted you can take backup of your files also by simply using "Cloudbacko home" software i am basically using this software from long time and really satisfied using this software. "Cloudbacko home supports Support continuous backup in Windows . Leaving a link just check: http://www.cloudbacko.com/free-backup.jsp
-
Samuel Suther commented
Here, optimized:
#!/bin/bash
base="/home/suther/Dropbox/Firma/Zeiterfassung"
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbinperiodicity="$1"
filename="$2".tsk
if ! [[ -f $base/$filename ]] ; then
filename=Zeiterfassung.tsk
fi
if ! [[ -z $periodicity ]] ; then
source="$base/${filename}"
mkdir -p -- "$base/$periodicity"
cp -- "$source" "$base/$periodicity/$(date +%y%m%d_%H%M)_${filename}"
kdialog --title "Backup Taskcoach" --msgbox "Zeiterfassung $periodicity ($filename) saved to $base/$periodicity" --display :0.0
else
echo Usage: $0 [daily|weekly|monthly] [file name]
fi -
Anonymous commented
This script is horrible, buggy and I recommend against its use by anyone for any purpose. In the future be responsible and don't share shell scripts unless you know how to write correct shell code.