From 22bab3569573cb0a7771e40bcc38f10902dd6baf Mon Sep 17 00:00:00 2001 From: ub1x Date: Mon, 1 Nov 2021 22:17:28 +0100 Subject: [PATCH] Add SicherPC.sh to save some generic settings and some HW infos --- README.md | 1 + SicherPC.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100755 SicherPC.sh diff --git a/README.md b/README.md index dcc0da9..9234b37 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,5 @@ See also at [LUG-VS-Wiki Nützliche Scripte](https://lug-vs.org//lugvswiki/index |[utf8.sh](utf8.sh)|Convert text from e.g. Windows latin1 to utf8 text (e.g. in READMEs or other text (not for office documents))| |[SchredderHDD.sh](SchredderHDD.sh)|Delete a mechanical Hard Disk (HDD) reliably to ensure before forward it to the recycling, that no old data are there| |[wmf2svg.sh](wmf2svg.sh)|Example script converts WMF files in SVG to share it easily on the internet| +|[SicherPC.sh](SicherPC.sh)|Save some helpfull settings (not /home) and some general informatins| diff --git a/SicherPC.sh b/SicherPC.sh new file mode 100755 index 0000000..0dcb73e --- /dev/null +++ b/SicherPC.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Sichere wichtige Einstellungen +# +# Ulf@ulf-bartholomaeus.de +VERSION="Version 0.2.3 from 28.09.2021" + +# 0.2.3 +# update pathes +# 0.2.2 +# fixed test -f /proc/mdstat -> removed "cat" and remove ";" after "do" +# 0.2.1 +# lspcci Umleitung in Datei gefixt +# 0.2.0 +# verschiedene HW info hinzu (ab "HW-Info") +# 0.1.9 +# home.luna -> home.maxi +# 0.1.8 +# /var/lib/named ebenfalls sichern +# 0.1.7 +# Fehler /bin/etc -> /usr/etc +# 0.1.6 +# Backup um /var/yp/ und /usr/lib/ypbind/ ergänzen +# 0.1.5: +# /mnt/data2/PC-Sicherungen => /home.luna/users/PC-Sicherungen aktualisiert +# Check /mnt/backup and /mnt/bkp +# 0.1.4: +# /bin/etc hinzu + +if [ -d /home.maxi/users/PC-Sicherungen ] ; then + MyDest=/home.maxi/users/PC-Sicherungen +else + if [ -d /home/users/PC-Sicherungen ] ; then + MyDest=/home/users/PC-Sicherungen + else + echo "*** Error: No Destination found" + exit 10 + fi +fi +if [ -d ${MyDest}/$(hostname) ] ; then + MyDest=${MyDest}/$(hostname) +fi +if [ "$1"="-v" ] ; then + echo "Sichere /etc und /root sowie SmartCtl in Ziel <${MyDest}>" +fi +#tgz ${MyDest}/$(hostname)_$(date +%F)_etc.tgz /etc /usr/etc +tar -cvzf ${MyDest}/$(hostname)_$(date +%F)_etc.tgz /etc /usr/etc +#tgz ${MyDest}/$(hostname)_$(date +%F)_root.tgz /root +tar -cvz --exclude=/root/.duc.db -f ${MyDest}//$(hostname)_$(date +%F)_root.tgz /root +[ -d /var/lib/named/ ] && tgz ${MyDest}/$(hostname)_$(date +%F)_named.tgz /var/lib/named/ +[ -d /var/yp/ ] && tgz ${MyDest}/$(hostname)_$(date +%F)_yp.tgz /var/yp/ +[ -d /usr/lib/ypbind/ ] && tgz ${MyDest}/$(hostname)_$(date +%F)_ypbind.tgz /usr/lib/ypbind/ +## HW-Info +which hwinfo &> /dev/null && hwinfo &> ${MyDest}/hwinfo_$(date +%F).txt +which hwinfo &> /dev/null && hwinfo --short &> ${MyDest}/hwinfo-short_$(date +%F).txt +which inxi &> /dev/null && inxi -Fxd &>> ${MyDest}/inxi-Fxd_$(date +%F).txt ## disabled da inxi sich in scripten aufhängt +which lspci &> /dev/null && lspci &> ${MyDest}/lspcci _$(date +%F).txt +which fdisk &> /dev/null && fdisk -l &>> ${MyDest}/fdisk-l_$(date +%F).txt +which lsblk &> /dev/null && lsblk &>> ${MyDest}/lsblk_$(date +%F).txt +cp /etc/fstab ${MyDest}/fstab_$(date +%F).txt +which mdadm &> /dev/null && for dev in $( mdadm -Ebsc=partitions | cut -d' ' -f2 ) ; do mdadm -D $dev &>> ${MyDest}/mdadm-D_$(date +%F).txt ; done +[ -f /proc/mdstat ] && cp /proc/mdstat ${MyDest}/mdstat_$(date +%F).txt +which sensors &> /dev/null && sensors &> ${MyDest}/sensors_$(date +%F).txt +which sensors &> /dev/null && sensors -u &>> ${MyDest}/sensors-u_$(date +%F).txt