I won't answer this homework question, but ....
https://www.tldp.org/LDP/Bash-Beginn...ers-Guide.html
Holger_Gehrke hit on the date part and looking at the manpage for date.
There are other format control options which can be interesting. Put them together, if you like. Using yymmdd-hhMM is very helpful for sorting.
As for using cron, add this to your crontab as a cheat sheet:
Code:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * /full/path/to/command to be executed
# * * * * * /full/path/to/command --arg1 --arg2 file1 file2 2>&1
# m h dom mon dow command
There are how-to guides for doing crontab -e or videos. If you get stuck, post what you have. Be certain to never assume the PATH is set the way you expect and realize that cron doesn't setup much of any environment. It is definitely NOT the same as an interactive login environment.