dayrotate.pl
Code:
#!/usr/bin/perl
use File::Copy;
@weekdays = ('sunday.jpg','monday.jpg','tuesday.jpg','wednesday.jpg',
'thursday.jpg','friday.jpg','saturday.jpg');
my ($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime time;
copy($weekdays[$wday],'today.jpg');
copy($weekdays[($wday==0?7:($wday-1))],'yesterday.jpg');
copy($weekdays[($wday<1?($wday+6):($wday-2))],'twodaysago.jpg');
copy($weekdays[($wday<2?($wday+5):($wday-3))],'threedaysago.jpg');
cron entry:
Code:
0 0 * * * cd /var/www/domain.com/images/;/usr/bin/perl /var/www/domain.com/images/dayrotate.pl > /dev/null
Your 'day' images will be sunday.jpg, monday.jpg, etc.
in your html, you refer to
today.jpg, yesterday.jpg, twodaysago.jpg and threedaysago.jpg