I set up a cronjob to write a webpage every 50 minutes, but when accessing them, the webpages were blank.
The cronjob: 50 * * * * mkIndex.sh > /home/user/img/index.html.
The mkIndex.sh is a script I wrote, in /home/$USER/bin, which is in the $PATH, running the script in the same way shown in crontab seems to work fine, it generates the webpage.
So why is my index.html file blank? Alternatively, can you see any flaw in my script?
#!/bin/bash
echo -e "<!DOCTYPE html>\n<head>\n"
echo -e "<style>\ndiv.gallery {\nmargin: 1px;\nborder: 1px solid #ccc;\nfloat: left;\n"
echo -e" width: 180px;\n}\n\ndiv.gallery:hover {\nborder: 1px solid #777;\n}\n\ndiv.gallery img {\n"
echo -e "width: 10%;\nheight: auto;\n}\n"
echo -e "</style>\n</head>\n"
echo -e "<body>\n"
cd /home/user/img
for i in `ls *.png`
do
echo -e "<div class="gallery">"
echo -e "<a target="$i" href="$i">"
echo -e " <img src="$i" width="300" height="200">"
echo -e "</a>"
echo -e "</div>"
done
echo -e "</body>\n</html>"
I'm not sure why my cronjob isn't generating the desired output.