I have a bash script running some code 24/7. I am currently using a timer in the script to reboot the machine every 43000 seconds. This is not working well because each time the machine fires up the script again, it reboots over and over until a certain amount of time has passed.
I don't know why but I would prefer to check the clock and reboot at some set time such as 3am.
What code would I put into my script which would check the time and when it is 3am, it would run a command.
My function currently looks like this. There is a loop which runs this function every 43000 seconds.