lock_unlock_bashrc.sh aktualisiert

Logging hinzugefügt.
This commit is contained in:
alf
2025-08-15 16:25:03 +00:00
parent a866059100
commit e03c823db3

View File

@ -1,3 +1,8 @@
source /root/logger.sh
log_start
log_info "Starte Lock/Unlock Bashrc"
ende=nein ende=nein
while [ $ende = "nein" ]; do while [ $ende = "nein" ]; do
@ -17,18 +22,18 @@ read -p "Deine Wahl: 1/2/3/0 " wwahl
if [ $wwahl = 1 ] if [ $wwahl = 1 ]
then then
sudo chattr +i .bashrc sudo chattr +i .bashrc
echo "Gesichert! "$? log_info "Gesichert! $?"
fi fi
if [ $wwahl = 2 ] if [ $wwahl = 2 ]
then then
sudo chattr -i .bashrc sudo chattr -i .bashrc
echo "Geöffnet! "$? log_info "Geöffnet! $?"
echo "öffne Datei..." log_info "öffne Datei..."
nano .bashrc nano .bashrc
echo "Datei geschlossen "$? log_info "Datei geschlossen $?"
sudo chattr +i .bashrc sudo chattr +i .bashrc
echo "Gesichert "$? log_info "Gesichert $?"
source /home/oberkoetter/.bashrc source /home/oberkoetter/.bashrc
echo "Änderungen sind nach dem Neustart der" echo "Änderungen sind nach dem Neustart der"
echo "Konsole wirksam" echo "Konsole wirksam"
@ -37,14 +42,15 @@ fi
if [ $wwahl = 22 ] if [ $wwahl = 22 ]
then then
sudo chattr -i .bashrc sudo chattr -i .bashrc
echo "Geöffnet! "$? log_info "Geöffnet! $?"
exit 0 exit 0
fi fi
if [ $wwahl = "3" ] if [ $wwahl = "3" ]
then then
log_info "Lese neu…"
. .bashrc . .bashrc
echo $? log_info "Err: $?"
fi fi
if [ $wwahl = "0" ] if [ $wwahl = "0" ]
@ -53,3 +59,5 @@ then
fi fi
done done
log_end