Preparing script to also handle running when RPi shuts down