Fix check_autoboot_status to correctly identify and terminate autoboot_win.sh without including current SSH session process.

Adjusted the check_autoboot_status function in long_press.sh to use pgrep with -af and grep -v 8424 to exclude the current process, ensuring accurate detection and termination of autoboot_win.sh on the remote device.

Added output for terminated_successfully status to indicate script completion and readiness for subsequent actions.

Fixes: #123
This commit is contained in:
Michael Haider 2024-06-19 17:36:04 +02:00
parent 111d73273a
commit 2d5f72ad40

View File

@ -27,9 +27,9 @@ duration=120
# Funktion, um Prozess auf dem Remote-Gerät zu überprüfen
check_autoboot_status() {
/usr/bin/ssh -i /root/.ssh/id_rsa root@192.168.178.80 '
if pgrep -a autoboot_win.sh >/dev/null; then
if /usr/bin/pgrep -af "autoboot_win.sh" | grep -v $$; then
echo "running"
pkill -f autoboot_win.sh
/usr/bin/pkill -f "autoboot_win.sh"
else
echo "not_running"
fi
@ -64,6 +64,9 @@ while true; do
sleep 5
done
# Status von "terminated_successfully" ausgeben
echo "### Variable 'terminated_successfully' ist $terminated_successfully ###"
# Wenn das Skript erfolgreich beendet wurde, Handshakes übertragen und cracking-Skript starten
if [ "$terminated_successfully" = true ]; then
echo "Übertrage Handshakes und starte crack_handshakes.sh"