ly/Makefile: Sort variables
[sunny256-utils.git] / ta_backup
blobf6e4e6279cfbba4f3022531d0b92fa26ad0378da
1 #!/usr/bin/env bash
3 #=======================================================================
4 # ta_backup
5 # File ID: 923caf7a-6fa9-11e2-a5bc-0016d364066c
6 # Backup stuff to the external harddisk
7 # License: GNU General Public License version 2 or later.
8 #=======================================================================
10 progname=ta_backup
11 lockdir=$HOME/.$progname.LOCK
13 myexit() {
14 rmdir $lockdir || echo $progname: $lockdir: Cannot remove lockdir >&2
15 exit $1
18 msg() {
19 echo $progname: "$*"
22 trap "myexit 1" INT TERM
23 mkdir $lockdir || { echo $progname: $lockdir: Cannot create lockdir >&2; exit 1; }
25 test -d /media/seagate-3tb/backup || { echo $progname: seagate-3tb is not mounted >&2; myexit 1; }
27 if test -e /ubstud.mrk; then
28 desthome=/media/seagate-3tb/backup/ubstud/home
29 test -d $desthome || { echo $progname: $desthome: Directory not found >&2; myexit 1; }
30 msg Backup ubstud:/home/ to $desthome/
31 sess -t c_ta_backup -- sudo rsync -avP --delete /home/ $desthome/
34 myexit