Detect GPIO pins on boot and make decision accordingly

Thank you for your help,
I was able to set up a service that runs on startup, which in turn runs a shell script that does the required monitoring and starts the system in the suitable “mode”.

#!/bin/bash

echo 15 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio15/direction
pin15=$(cat /sys/class/gpio/gpio15/value)

echo 13 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio13/direction
pin13=$(cat /sys/class/gpio/gpio13/value)

echo 19 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio19/direction
pin19=$(cat /sys/class/gpio/gpio19/value)
echo $pin13
echo $pin15
echo $pin19

if [ $pin15 -eq 1 ] 
then #Run application in 1 mode
echo 'APPLICATION is running in 1 mode'
python3 /home/user/app1.py

elif [ $pin13 -eq 1 ] #Run application in 2 mode
then
echo 'APPLICATION is running in 2 mode'
systemctl start gdm3.service
python3 /home/tekno-h/app2.py

elif [ $pin19 -eq 1 ] #Run application in 3 mode
then
echo 'APPLICATION is running in 3 mode'
systemctl start gdm3.service 
fi

However I have a small problem, one of my applications requires a gui to display a camera output on the screen, and although the system starts the graphical interface, it stays stuck on the login window, I tried following this thread but it did not work:
[Auto login jetson nano 2gb - #14 by swapnilgtm1998]
Any ideas ?
Thanks again