I have an bash script that runs on a every minute cron. It checks to see if a necessary program is running and starts it if it is not. Occasionally it will run before the user has actually autologged in. I want to prevent that from happening.
What I think I'd like to do is to put a check in the check the computer's uptime and see if it'd been on for 5 minutes so that auto login had a chance to finish before the program gets started. I'm fairly new to bash and parsing what I get from "uptime" to where I could use it for comparison seems out of my reach.
Can anyone help? Perhaps there is a better solution. I'm stuck.