27 lines
901 B
Bash
27 lines
901 B
Bash
#!/bin/bash
|
|
|
|
# Define time zone names
|
|
declare -A time_zone_names
|
|
|
|
# Time Zone page group array
|
|
time_zone_names=( ["1234"]="America/New_York" ["5678"]="America/Denver" )
|
|
|
|
# Function to check if it's noon in a specific time zone and trigger the callback command
|
|
check_noon() {
|
|
number="$1" # Get the time zone number
|
|
time_zone="${time_zone_names["$number"]}" # Get the corresponding time zone name
|
|
TZ="$time_zone" # Set the time zone
|
|
current_time=$(TZ="$time_zone" date +'%H') # Get the current hour in the specified time zone
|
|
|
|
if [ "$current_time" -eq 12 ]; then
|
|
echo "It's noon in $time_zone"
|
|
/var/lib/asterisk/bin/callback "$number" chimes.s.1 0 0 "Ik5vb24gQ2hpbWUiIDw+"
|
|
else
|
|
echo "It's not noon in $time_zone"
|
|
fi
|
|
}
|
|
|
|
# Loop through the time zone numbers and check if it's noon
|
|
for number in "${!time_zone_names[@]}"; do
|
|
check_noon "$number"
|
|
done |