You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
722 B

#!/bin/bash
# Path to the XML file
xml_file="/home/sysadmin/vogel-sounds/cron-but-worse.xml"
while true; do
# Extract the desired times, descriptions, and scripts from the XML file
times=($(grep -oP '<time>\K[^<]+' "$xml_file"))
descriptions=($(grep -oP '<description>\K[^<]+' "$xml_file"))
scripts=($(grep -oP '<script>\K[^<]+' "$xml_file"))
# Get the current time in HH:MM format
current_time=$(date +%H:%M)
for ((i=0; i<${#times[@]}; i++)); do
if [[ $current_time == "${times[i]}" ]]; then
echo "Executing command at $current_time: ${descriptions[i]}"
eval "${scripts[i]}"
fi
done
sleep 60 # Sleep for 1 minute before checking again
done