changeset 1694:09aaca079ff3

add backup script
author Vadim Filimonov <fffilimonov@yandex.ru>
date Mon, 20 Jun 2022 11:12:25 +0300
parents 45eaaf5146f3
children 25833dd89844
files backup/macos/luanBackup.plist backup/macos/luanBackup.sh
diffstat 2 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
diff -r 45eaaf5146f3 -r 09aaca079ff3 backup/macos/luanBackup.plist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backup/macos/luanBackup.plist	Mon Jun 20 11:12:25 2022 +0300
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+  <key>Label</key>
+  <string>com.backup-luanhost</string>
+  <key>ProgramArguments</key>
+  <array>
+    <string>PWD/luanBackup.sh</string>
+  </array>
+  <key>UserName</key>
+  <string>USER</string>
+  <key>RunAtLoad</key><true/>
+  <key>KeepAlive</key><true/>
+</dict>
+</plist>
diff -r 45eaaf5146f3 -r 09aaca079ff3 backup/macos/luanBackup.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backup/macos/luanBackup.sh	Mon Jun 20 11:12:25 2022 +0300
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+BKP=/Volumes/External/luanBackup
+DIR=/Users/administrator/luan/backup
+
+function bkp_machine() {
+  mkdir -p $BKP 2>/dev/null;
+
+  rm -f `find $BKP/ -name '*.tgz' -mmin +4000`;
+
+  cd $DIR;
+  ./stop.sh
+  tar czvf /Volumes/External/luanBackup/$(date +"backup%Y%m%d%H%M").tgz backups;
+  ./start.sh
+}
+
+sleep 60;
+bkp_machine;
+
+sleep 3600;