From 4a915b7a39777b42c78c67892d5a2d402063915a Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Mon, 10 Jun 2019 10:19:55 -0300 Subject: [PATCH 1/3] Improving Android ADB Backup report Included info about the exported file size and time of execution at the end of the run command. --- Android/android-backup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Android/android-backup.sh b/Android/android-backup.sh index 5a8a516..63664eb 100755 --- a/Android/android-backup.sh +++ b/Android/android-backup.sh @@ -1 +1,4 @@ -adb backup -apk -shared -all -f /run/media/bruno/Multimedia/My\ Backups/android_backup.ab && kdialog --title "Android Backup Complete" --msgbox "Android Backup finished successfully" + +time adb backup -apk -shared -all -f /run/media/bruno/Multimedia/My\ Backups/android_backup.ab && kdialog --title "Android Backup Complete" --msgbox "Android Backup finished successfully" +echo +ls -lh /run/media/bruno/Multimedia/My\ Backups/android_backup.ab | gawk '{ printf $5 " "; for(i=6;i<=NF;i++) printf $i " "; print "\n" }' From 17944a0867a03c092fcd419477b0efe08926d3ab Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Mon, 10 Jun 2019 10:21:41 -0300 Subject: [PATCH 2/3] Including hooks to keep /var folder clean using paccache Included hooks to delete old cache files from pacman, to avoid /var folder to stay full --- Pacman/clean_package_cache.hook | 11 +++++++++++ Pacman/clean_uninstalled_packages.hooks | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 Pacman/clean_package_cache.hook create mode 100644 Pacman/clean_uninstalled_packages.hooks diff --git a/Pacman/clean_package_cache.hook b/Pacman/clean_package_cache.hook new file mode 100644 index 0000000..5d0394d --- /dev/null +++ b/Pacman/clean_package_cache.hook @@ -0,0 +1,11 @@ +# Copy this file into /etc/pacman.d/hooks folder +[Trigger] +Operation = Upgrade +Operation = Install +Operation = Remove +Type = Package +Target = * +[Action] +Description = Bruno: Cleaning pacman cache... +When = PostTransaction +Exec = /usr/bin/paccache -r diff --git a/Pacman/clean_uninstalled_packages.hooks b/Pacman/clean_uninstalled_packages.hooks new file mode 100644 index 0000000..e69c2a5 --- /dev/null +++ b/Pacman/clean_uninstalled_packages.hooks @@ -0,0 +1,9 @@ +# Copy this file into /etc/pacman.d/hooks folder +[Trigger] +Operation = Remove +Type = Package +Target = * +[Action] +Description = Bruno: Cleaning removed packages pacman cache... +When = PostTransaction +Exec = /usr/bin/paccache -ruk0 From f6246fb6a9f15102851afd3a97793f4b79004c0c Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Mon, 10 Jun 2019 12:29:06 -0300 Subject: [PATCH 3/3] Including systemd services to backup VPS --- Services/backup-contabo-db.service | 5 +++++ Services/backup-contabo-db.timer | 10 ++++++++++ Services/backup-contabo-files.service | 5 +++++ Services/backup-contabo-files.timer | 10 ++++++++++ Services/logError.sh | 2 ++ Services/logErrors@.service | 6 ++++++ 6 files changed, 38 insertions(+) create mode 100644 Services/backup-contabo-db.service create mode 100644 Services/backup-contabo-db.timer create mode 100644 Services/backup-contabo-files.service create mode 100644 Services/backup-contabo-files.timer create mode 100755 Services/logError.sh create mode 100644 Services/logErrors@.service diff --git a/Services/backup-contabo-db.service b/Services/backup-contabo-db.service new file mode 100644 index 0000000..83f2e7d --- /dev/null +++ b/Services/backup-contabo-db.service @@ -0,0 +1,5 @@ +[Unit] +Description=Backup contabo db daily + +[Service] +ExecStart=/home/bruno/Backups/Contabo/backup-db.sh diff --git a/Services/backup-contabo-db.timer b/Services/backup-contabo-db.timer new file mode 100644 index 0000000..4f75156 --- /dev/null +++ b/Services/backup-contabo-db.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Backup contabo db dayly + +[Timer] +#DayOfWeek Year-Month-Day Hour:Minute:Second +OnCalendar=*-*-* 10:00:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/Services/backup-contabo-files.service b/Services/backup-contabo-files.service new file mode 100644 index 0000000..01c813e --- /dev/null +++ b/Services/backup-contabo-files.service @@ -0,0 +1,5 @@ +[Unit] +Description=Backup contabo files once per week + +[Service] +ExecStart=/home/bruno/Backups/Contabo/backup-files.sh diff --git a/Services/backup-contabo-files.timer b/Services/backup-contabo-files.timer new file mode 100644 index 0000000..0e45f51 --- /dev/null +++ b/Services/backup-contabo-files.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Backup contabo files once per week + +[Timer] +#DayOfWeek Year-Month-Day Hour:Minute:Second +OnCalendar=Mon *-*-* 11:00:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/Services/logError.sh b/Services/logError.sh new file mode 100755 index 0000000..5643ef5 --- /dev/null +++ b/Services/logError.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo /bin/systemctl status --full "$1" >> /home/bruno/.log_error diff --git a/Services/logErrors@.service b/Services/logErrors@.service new file mode 100644 index 0000000..68a257a --- /dev/null +++ b/Services/logErrors@.service @@ -0,0 +1,6 @@ +[Unit] +Description=Log Systemd errors on my %i script on home + +[Service] +ExecStart=/home/bruno/Apps/linuxShortcuts/Services/logError.sh %i +#ExecStart=/bin/systemctl status --full %i >> /home/bruno/.log_error