I want to run a script once day (and only on weekends), however, I cannot use cron job for that.
I was thinking about having an infinite while loop, sleep for 24 hours, check if it is a weekend, and if so execute the script.
What it's a good solution under bash on linux?
my current implementation:
#! /bin/bash
while [ true ]; do
if [[ $(date +%u) -lt 6 ]]; then
./program
else
echo Today is a weekend, processing is skipped. Back to sleep.
fi
sleep 86400
done
And I will launch this script at 5 pm.