site_treelogo
  -   Terms of Use and Privacy
Apps | GNU/Linux | IT Prepper | Meta
rss
site_treelogo
  -   Terms of Use and Privacy
Apps | GNU/Linux | IT Prepper | Meta
rss

<<   <   >   >>

2021-03-31 | GNU/Linux | Five Minute Crontab w/ Timestamp

If you want to back up a directory every five minutes using cron with a timestamp:

*/5 * * * * tar -cJpf /destdir/`date +%Y%m%d%H%M%S`.somename.bak.tar.xz /sourcdir

We are running fcron with rsyslog and Loganalyzer, and the output looks like this with the above:

Using xz can be heavy. In this particular case, we are backing up text, so the overhead is worth it. We compiled fcron without sendmail, so the usual email redirect isn't necessary, at least for our config. Regardless, this article is mainly to document the BASH timestamp bit and the */5 notation for the crontab entry... so we're good.

cron