Created
May 30, 2018 16:24
-
-
Save liladas/dfe59dc60afb2e519827938ca8d68534 to your computer and use it in GitHub Desktop.
Check DST for cronjobs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PST_TIME=$(env TZ=America/Los_Angeles date +"%-H") | |
| UTC_TIME=$(env TZ=UTC date +"%-H") | |
| DST_CHECK=$(($PST_TIME + 8 - $UTC_TIME)) | |
| echo "PST Hour:" $PST_TIME | |
| echo "UTC Hour:" $UTC_TIME | |
| echo "DST CHECK:" $DST_CHECK | |
| if [ "$DST_CHECK" -eq "1" ];then | |
| echo "DST +1 active" | |
| else | |
| echo "DST +1 inactive" | |
| echo "We should actually start this an hour later. Going to sleep for 1 hour..." | |
| sleep 3600 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment