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