This commit is contained in:
simono41 2019-08-02 14:54:43 +02:00
parent 9ba4093017
commit ee1a3085f4
3 changed files with 49 additions and 49 deletions

View file

@ -20,11 +20,11 @@ echo "Als root Angemeldet"
while (( "$#" ))
do
for wort in ${1}
do
echo "$wort"
export ${wort%=*}=${wort#*=}
echo "Parameter ${wort%=*} = ${wort#*=}"
done
do
echo "$wort"
export ${wort%=*}=${wort#*=}
echo "Parameter ${wort%=*} = ${wort#*=}"
done
shift
done
@ -36,69 +36,69 @@ sudo modprobe dm-mirror # Lädt den "mirror"-Treiber welcher für pvmove notwend
function makebackup() {
mkdir tmpstorage
mount ${device} tmpstorage
mkdir target
mount ${target} target
tar -czf tmpstorage/backup.tar.gz target/*
umount target
umount tmpstorage
mkdir tmpstorage
mount ${device} tmpstorage
mkdir target
mount ${target} target
tar -czf tmpstorage/backup.tar.gz target/*
umount target
umount tmpstorage
}
function makelvm() {
pvcreate ${device}
pvcreate ${device1}
pvdisplay
vgcreate server0 ${device}
lvcreate -L50G --name=ext4 server0
lvcreate -L50G --name=xzf server0
pvcreate ${device}
pvcreate ${device1}
pvdisplay
vgcreate server0 ${device}
lvcreate -L50G --name=ext4 server0
lvcreate -L50G --name=xzf server0
parted /dev/server0/ext4 set 1 raid on
parted /dev/server1/ext4 set 1 raid on
parted /dev/server0/ext4 set 1 raid on
parted /dev/server1/ext4 set 1 raid on
mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/server0/ext4 /dev/server1/ext4
mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/server0/ext4 /dev/server1/ext4
vgcreate server1 ${device1}
lvcreate -L50G --name=ext4 server1
lvcreate -L50G --name=xfs server1
vgcreate server1 ${device1}
lvcreate -L50G --name=ext4 server1
lvcreate -L50G --name=xfs server1
parted /dev/server0/xfs set 1 raid on
parted /dev/server1/xfs set 1 raid on
parted /dev/server0/xfs set 1 raid on
parted /dev/server1/xfs set 1 raid on
mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/server0/xfs /dev/server1/xfs
mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/server0/xfs /dev/server1/xfs
mkfs -L p_debian_ext4 -t ext4 /dev/md0
mkfs -L p_debian_ext4 -t ext4 /dev/md0
mkfs -L p_debian_xfs -t xfs /dev/md1
mkfs -L p_debian_xfs -t xfs /dev/md1
}
function bindsym() {
mount /dev/md0 target
cd target
mkdir boot
mount ${device} boot
mkdir sys proc dev
mount --bind /sys sys
mount --bind /dev dev
mount --bind /proc proc
mount /dev/md0 target
cd target
mkdir boot
mount ${device} boot
mkdir sys proc dev
mount --bind /sys sys
mount --bind /dev dev
mount --bind /proc proc
}
function restorebackup() {
tar -xzf backup.tar.gz -C target
tar -xzf backup.tar.gz -C target
}
function repairbootloader() {
deviceuuid=$(blkid -s UUID -o value ${device})
echo ${deviceuuid} >> target/etc/fstab
echo "Bitte nochmal nachschauen ob noch alte Einträge entfernt werden müssen!!!"
echo "SystemD suckt total sonst rum ^^"
echo "/etc/mkinitcpio.conf in Hooks einfügen lvm2 vor filesystem"
deviceuuid=$(blkid -s UUID -o value ${device})
echo ${deviceuuid} >> target/etc/fstab
echo "Bitte nochmal nachschauen ob noch alte Einträge entfernt werden müssen!!!"
echo "SystemD suckt total sonst rum ^^"
echo "/etc/mkinitcpio.conf in Hooks einfügen lvm2 vor filesystem"
chroot target aptitude install lvm2
chroot target grub-install ${device%?}
chroot target update-grub
chroot target dpkg-reconfigure linux-image-mylinuxversion
chroot target aptitude install lvm2
chroot target grub-install ${device%?}
chroot target update-grub
chroot target dpkg-reconfigure linux-image-mylinuxversion
}

View file

@ -37,7 +37,7 @@ echo -e "\033[1;33m Systemzeit: \033[0m" `date | awk '{print $4}'`
echo -e "\033[1;33m Online seit: \033[0m" `uptime | awk '{print $3}'` "Stunden"
echo -e "\033[1;33m Speichernutzung: \033[0m" `cat /proc/meminfo|grep 'MemF'| awk '{print $2}'` "kB von" `cat /proc/meminfo|grep 'MemT'| awk '{print $2}'` "kB frei"
if [ -f /sys/class/thermal/thermal_zone0/temp ]; then
echo -e "\033[1;33m CPU-Temp: \033[0m" `cat /sys/class/thermal/thermal_zone0/temp| awk '{print $1/1000}'` "°C"
echo -e "\033[1;33m CPU-Temp: \033[0m" `cat /sys/class/thermal/thermal_zone0/temp| awk '{print $1/1000}'` "°C"
fi
echo -e "\033[1;33m IPs: \033[0m" `ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1`
echo -e "\033[1;33m Macs: \033[0m" `ip link | grep ether`

View file

@ -37,7 +37,7 @@ echo -e "\033[1;33m System time: \033[0m" `date | awk '{print $4}'`
echo -e "\033[1;33m Online time: \033[0m" `uptime | awk '{print $3}'` "Stunden"
echo -e "\033[1;33m Memory Usage: \033[0m" `cat /proc/meminfo|grep 'MemF'| awk '{print $2}'` "kB von" `cat /proc/meminfo|grep 'MemT'| awk '{print $2}'` "kB frei"
if [ -f /sys/class/thermal/thermal_zone0/temp ]; then
echo -e "\033[1;33m CPU-Temp: \033[0m" `cat /sys/class/thermal/thermal_zone0/temp| awk '{print $1/1000}'` "°C"
echo -e "\033[1;33m CPU-Temp: \033[0m" `cat /sys/class/thermal/thermal_zone0/temp| awk '{print $1/1000}'` "°C"
fi
echo -e "\033[1;33m IPs: \033[0m" `ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1`
echo -e "\033[1;33m Macs: \033[0m" `ip link | grep ether`