I'm running in to a few hitches in a shell script I'm making for my job. Everything seems to be working correctly until it gets to the point where it kills the instance of chrome that is displaying a catalog and then opens an instance of chrome that displays a slideshow if the raspberry pi is idle long enough.
What I am seeing is the slideshow chrome getting killed even though nothing has been touched. I can't tell if it's xprintidle even though I'm running an echo script to check what the idle timer displays, when chrome gets killed sometimes the idle timer has been reset indicating activity and sometimes it's not reset and still in the timeframe where it should be displaying that slideshow.
This is the code that runs the first part, it runs in a loop and checks to make sure chrome is open to the catalog page unless the screensaver.status file is present this makes sure that if the catalog gets closed by a user it will reopen (This script is ran at boot as an autorun):
#!/bin/bash while : do RUNNING=$(pidof chromium-browse) if [ -n "$RUNNING" ] && [ ! -f /home/pi/statusfiles/screensaver.status ] then sleep 1 else touch /home/pi/statusfiles/catalog.status chromium-browser --start-maximized --user-data-dir=/home/pi/chromiumsessions/chromiumlive --incognito http://www.google.com sleep 10 fi sleep 1 done
This is the code that runs the process to kill the screensaver process when the mouse is moved (causing xprintidle to reset) this also clears the user data out of the chrome instance every 2 minutes, and when xprintidle reaches a certain time it kills the catalog chrome session and opens up the screensaver session (This script is run as a cronjob):
#!/bin/bash while true do RUNNING=$(pidof chromium-browse) IDLETIME=$(export DISPLAY=:0 && sudo -u pi xprintidle) if [ "$IDLETIME" -lt "120000" ] && [ ! -f /home/pi/statusfiles/catalog.status ] then killall chromium-browser rm -rf /home/pi/statusfiles/screensaver.status else sleep 1 fi if [ "$IDLETIME" -gt "120000" ] && [ "$IDLETIME" -lt "300000" ] && [ -f /home/pi/statusfiles/catalog.status ] then killall chromium-browser sleep 1 rm -rf /home/pi/chromiumsessions/chromiumlive rm -rf /home/pi/Downloads/* mkdir /home/pi/chromiumsessions/chromiumlive chown -R pi:pi /home/pi/chromiumsessions/chromiumlive cp -R /home/pi/chromiumsessions/chromiumgood/* /home/pi/chromiumsessions/chromiumlive/ chown -R pi:pi /home/pi/chromiumsessions/chromiumlive rm -rf /home/pi/statusfiles/catalog.status sleep 120 else sleep 1 fi if [ "$IDLETIME" -gt "300000" ] && [ ! -f /home/pi/statusfiles/screensaver.status ] then touch /home/pi/statusfiles/screensaver.status killall chromium-browser rm -rf /home/pi/statusfiles/catalog.status chromium-browser --temp-profile --kiosk --start-fullscreen http://www.google.com/ else sleep 1 fi done
Any and all help is greatly appreciated.