beautysh
This commit is contained in:
parent
9ba4093017
commit
ee1a3085f4
3 changed files with 49 additions and 49 deletions
|
@ -20,11 +20,11 @@ echo "Als root Angemeldet"
|
||||||
while (( "$#" ))
|
while (( "$#" ))
|
||||||
do
|
do
|
||||||
for wort in ${1}
|
for wort in ${1}
|
||||||
do
|
do
|
||||||
echo "$wort"
|
echo "$wort"
|
||||||
export ${wort%=*}=${wort#*=}
|
export ${wort%=*}=${wort#*=}
|
||||||
echo "Parameter ${wort%=*} = ${wort#*=}"
|
echo "Parameter ${wort%=*} = ${wort#*=}"
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -36,69 +36,69 @@ sudo modprobe dm-mirror # Lädt den "mirror"-Treiber welcher für pvmove notwend
|
||||||
|
|
||||||
|
|
||||||
function makebackup() {
|
function makebackup() {
|
||||||
mkdir tmpstorage
|
mkdir tmpstorage
|
||||||
mount ${device} tmpstorage
|
mount ${device} tmpstorage
|
||||||
mkdir target
|
mkdir target
|
||||||
mount ${target} target
|
mount ${target} target
|
||||||
tar -czf tmpstorage/backup.tar.gz target/*
|
tar -czf tmpstorage/backup.tar.gz target/*
|
||||||
umount target
|
umount target
|
||||||
umount tmpstorage
|
umount tmpstorage
|
||||||
}
|
}
|
||||||
|
|
||||||
function makelvm() {
|
function makelvm() {
|
||||||
pvcreate ${device}
|
pvcreate ${device}
|
||||||
pvcreate ${device1}
|
pvcreate ${device1}
|
||||||
pvdisplay
|
pvdisplay
|
||||||
vgcreate server0 ${device}
|
vgcreate server0 ${device}
|
||||||
lvcreate -L50G --name=ext4 server0
|
lvcreate -L50G --name=ext4 server0
|
||||||
lvcreate -L50G --name=xzf server0
|
lvcreate -L50G --name=xzf server0
|
||||||
|
|
||||||
parted /dev/server0/ext4 set 1 raid on
|
parted /dev/server0/ext4 set 1 raid on
|
||||||
parted /dev/server1/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}
|
vgcreate server1 ${device1}
|
||||||
lvcreate -L50G --name=ext4 server1
|
lvcreate -L50G --name=ext4 server1
|
||||||
lvcreate -L50G --name=xfs server1
|
lvcreate -L50G --name=xfs server1
|
||||||
|
|
||||||
parted /dev/server0/xfs set 1 raid on
|
parted /dev/server0/xfs set 1 raid on
|
||||||
parted /dev/server1/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() {
|
function bindsym() {
|
||||||
mount /dev/md0 target
|
mount /dev/md0 target
|
||||||
cd target
|
cd target
|
||||||
mkdir boot
|
mkdir boot
|
||||||
mount ${device} boot
|
mount ${device} boot
|
||||||
mkdir sys proc dev
|
mkdir sys proc dev
|
||||||
mount --bind /sys sys
|
mount --bind /sys sys
|
||||||
mount --bind /dev dev
|
mount --bind /dev dev
|
||||||
mount --bind /proc proc
|
mount --bind /proc proc
|
||||||
}
|
}
|
||||||
|
|
||||||
function restorebackup() {
|
function restorebackup() {
|
||||||
tar -xzf backup.tar.gz -C target
|
tar -xzf backup.tar.gz -C target
|
||||||
}
|
}
|
||||||
|
|
||||||
function repairbootloader() {
|
function repairbootloader() {
|
||||||
deviceuuid=$(blkid -s UUID -o value ${device})
|
deviceuuid=$(blkid -s UUID -o value ${device})
|
||||||
echo ${deviceuuid} >> target/etc/fstab
|
echo ${deviceuuid} >> target/etc/fstab
|
||||||
echo "Bitte nochmal nachschauen ob noch alte Einträge entfernt werden müssen!!!"
|
echo "Bitte nochmal nachschauen ob noch alte Einträge entfernt werden müssen!!!"
|
||||||
echo "SystemD suckt total sonst rum ^^"
|
echo "SystemD suckt total sonst rum ^^"
|
||||||
echo "/etc/mkinitcpio.conf in Hooks einfügen lvm2 vor filesystem"
|
echo "/etc/mkinitcpio.conf in Hooks einfügen lvm2 vor filesystem"
|
||||||
|
|
||||||
chroot target aptitude install lvm2
|
chroot target aptitude install lvm2
|
||||||
chroot target grub-install ${device%?}
|
chroot target grub-install ${device%?}
|
||||||
chroot target update-grub
|
chroot target update-grub
|
||||||
chroot target dpkg-reconfigure linux-image-mylinuxversion
|
chroot target dpkg-reconfigure linux-image-mylinuxversion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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 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"
|
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
|
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
|
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 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`
|
echo -e "\033[1;33m Macs: \033[0m" `ip link | grep ether`
|
||||||
|
|
|
@ -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 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"
|
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
|
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
|
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 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`
|
echo -e "\033[1;33m Macs: \033[0m" `ip link | grep ether`
|
||||||
|
|
Loading…
Reference in a new issue