#!/bin/bash # ============================================= # Automation_Custom_PreScript.sh # Starts slow LED flasher and exits immediately # ============================================= echo -e '[Time]\nStepTimeChangeMs=1000000000000' > /etc/systemd/timesyncd.conf LED_PIN=16 # Create the flasher as a small standalone script in /tmp (very early, always writable) cat > /tmp/led-flasher.sh << 'EOF' #!/bin/bash LED_PIN=16 while true; do pinctrl set $LED_PIN op dh sleep 1 pinctrl set $LED_PIN op dl sleep 1 done EOF chmod +x /tmp/led-flasher.sh # Fully detach it using setsid + nohup (this is the most reliable combo early in boot) nohup setsid /tmp/led-flasher.sh > /dev/null 2>&1 < /dev/null & # Save PID for later killing echo $! > /var/run/flash-slow.pid # Important: Exit immediately and cleanly exit 0