Bash script to change the run state and to check it at every boot
Posted: Sat Nov 04, 2017 12:36 pm
Here a simple bash script to change the run state.
Use case example:
We have three state, Day, Night and Armed. The Day state is from 8 to 24. The Night state is from 24 to 8.
We can set via cron to switch from Day to Night and vice-versa, except for the case if the current state is Armed.
We can set via cron to check at every boot if the current state is correct comparing the current hour and in case the state is wrong we can set the right state.
Use case example:
We have three state, Day, Night and Armed. The Day state is from 8 to 24. The Night state is from 24 to 8.
We can set via cron to switch from Day to Night and vice-versa, except for the case if the current state is Armed.
We can set via cron to check at every boot if the current state is correct comparing the current hour and in case the state is wrong we can set the right state.