|
|
@ -0,0 +1,22 @@ |
|
|
|
#!/bin/bash |
|
|
|
# Path to the XML file |
|
|
|
xml_file="./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 |