annotate backup/macos/luanBackup.sh @ 1694:09aaca079ff3

add backup script
author Vadim Filimonov <fffilimonov@yandex.ru>
date Mon, 20 Jun 2022 11:12:25 +0300
parents
children e6750146faa1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1694
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
1 #!/bin/bash
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
2
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
3 BKP=/Volumes/External/luanBackup
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
4 DIR=/Users/administrator/luan/backup
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
5
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
6 function bkp_machine() {
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
7 mkdir -p $BKP 2>/dev/null;
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
8
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
9 rm -f `find $BKP/ -name '*.tgz' -mmin +4000`;
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
10
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
11 cd $DIR;
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
12 ./stop.sh
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
13 tar czvf /Volumes/External/luanBackup/$(date +"backup%Y%m%d%H%M").tgz backups;
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
14 ./start.sh
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
15 }
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
16
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
17 sleep 60;
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
18 bkp_machine;
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
19
09aaca079ff3 add backup script
Vadim Filimonov <fffilimonov@yandex.ru>
parents:
diff changeset
20 sleep 3600;