Hacker Public Radio

HPR3657: Small time sysadmin


Listen Later

Creating Backups.
This script was trimmed to serve as an example.
The three options shown (email, jop, dots) demonstrates, how to list items with case statements:
Single item/directory (jop).
Multiple items in single directory (dots).
Multiple items in multiple directories (email).
The text files created after the archive serves as an item list
with current permissions.
tar --directory= /path/to/directory/ --create --file INSERT_ARCHIVE_NAME.tar /path/to/file;
#!/bin/bash
#License: GPL v3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#Name: getoverhere.sh
#Purpose:
#Version: beta 0.07
#Author: SGOTI (Some Guy On The Internet)
#Date: Sat 29 Jan 2022 02:19:29 AM EST
#variables:
VAR_TBALL=
VAR_TARGET=
VAR_JUMP=
VAR_VALUE=
#start:
cat << "EOT01"
Options:
email |"${HOME}/.thunderbird/"
jop |"${HOME}/Documents/joplin"
dots |"${HOME}/.bashrc .vimrc .bash_aliases"
EOT01
echo -e "What do you want to backup? : c."
read VAR_VALUE
case ${VAR_VALUE} in
"email" )
VAR_TBALL="INSERT_EMAIL_NAME$(date +%m-%d-%Y).tar.gz"
VAR_TARGET="msgFilterRules.dat"
VAR_JUMP="${HOME}/.thunderbird/*.default-release/ImapMail/imap.mail.yahoo.com/"
echo -e "Grabbing INSERT_EMAIL_NAME...n"
tar -C ${VAR_JUMP} --create --file ${VAR_TBALL} --gzip ${VAR_TARGET}
sleep 1
VAR_TBALL="INSERT_EMAIL_NAME$(date +%m-%d-%Y).tar.gz"
VAR_TARGET="msgFilterRules.dat"
VAR_JUMP="${HOME}/.thunderbird/*.default-release/ImapMail/imap.gmail.com/"
echo -e "Grabbing INSERT_EMAIL_NAME...n"
tar -C ${VAR_JUMP} --create --file ${VAR_TBALL} --gzip ${VAR_TARGET}
sleep 1
VAR_TBALL="EMAIL_ARCHIVES$(date +%m-%d-%Y).tar.gz"
VAR_TARGET="Mail/"
VAR_JUMP="${HOME}/.thunderbird/*.default-release/"
echo -e "Grabbing email EMAIL_ARCHIVES...n"
tar -C ${VAR_JUMP} --create --file ${VAR_TBALL} --gzip ${VAR_TARGET}
echo -e "Creating List for ${VAR_TBALL}...n"
ls -lhAR --group-directories-first ${VAR_JUMP}${VAR_TARGET} > EMAIL_ARCHIVES$(date +%m-%d-%Y).txt
sleep 1
VAR_TBALL="THUNDERBIRD_CALENDER$(date +%m-%d-%Y).tar.gz"
VAR_TARGET="calenders/"
VAR_JUMP="${HOME}/Documents/"
echo -e "Grabbing email THUNDERBIRD_CALENDER...n"
tar -C ${VAR_JUMP} --create --file ${VAR_TBALL} --gzip ${VAR_TARGET}
echo -e "Creating List for ${VAR_TBALL}...n"
ls -lhAR --group-directories-first ${VAR_JUMP}${VAR_TARGET} > THUNDERBIRD_CALENDER$(date +%m-%d-%Y).txt
sleep 1
VAR_TBALL="THUNDERBIRD_ADDRESS_BOOK$(date +%m-%d-%Y).tar.gz"
VAR_TARGET="address-book/"
VAR_JUMP="${HOME}/Documents/"
echo -e "Grabbing ${VAR_TARGET}...n"
tar -C ${VAR_JUMP} --create --file ${VAR_TBALL} --gzip ${VAR_TARGET}
echo -e "Creating List for ${VAR_TBALL}...n"
ls -lhAR --group-directories-first ${VAR_JUMP}${VAR_TARGET} > THUNDERBIRD_ADDRESS_BOOK$(date +%m-%d-%Y).txt
sleep 1
VAR_TBALL="THUNDERBIRD_ALL$(date +%m-%d-%Y).tar.gz"
VAR_TARGET=".thunderbird/"
VAR_JUMP="${HOME}/"
echo -e "Grabbing ${VAR_TARG
...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

290 Listeners

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec by Jerry Bell and Andrew Kalat

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec

372 Listeners

LINUX Unplugged by Jupiter Broadcasting

LINUX Unplugged

268 Listeners

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast) by Johannes B. Ullrich

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast)

651 Listeners

Curious Cases by BBC Radio 4

Curious Cases

822 Listeners

The Strong Towns Podcast by Strong Towns

The Strong Towns Podcast

422 Listeners

Late Night Linux by The Late Night Linux Family

Late Night Linux

164 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,056 Listeners

Cybersecurity Today by Jim Love

Cybersecurity Today

181 Listeners

CISO Series Podcast by David Spark, Mike Johnson, and Andy Ellis

CISO Series Podcast

189 Listeners

TechCrunch Daily Crunch by TechCrunch

TechCrunch Daily Crunch

42 Listeners

Strict Scrutiny by Crooked Media

Strict Scrutiny

5,807 Listeners

2.5 Admins by The Late Night Linux Family

2.5 Admins

98 Listeners

Cyber Security Headlines by CISO Series

Cyber Security Headlines

140 Listeners

What the Hack? by DeleteMe

What the Hack?

228 Listeners