Crontab issue w/ borgmatic

now this is strange. I want to run borgmatic (a configuration file that runs borgbackup) as a cronjob. borgmatic sits in /usr/bin but I can’t bring it to run borgbackup. Am I missing something here? The instructions for borgmatic are straightforward, see Step 6.


How have you set the cronjob?

What’s the output of crontab -l

Thanks Tom.

*/10 * * * * borgmatic


You want the backups to run every 10 min? Seems a bit excessive. I’d be surprised if a backup is completing before the next one is trying to start.

Have you tried the examples suggested on the site. Either every hour or every 3?

Thanks Tom.

the every ten mins is just for testing, it’s actually just one file :wink:


Does borgmatic work if its run manually?

Does it need to be run with sudo?

Thanks Tom.

Hi Tom, I run borgmatic --verbosity 1 in the CLI, and it works just fine. no sudo


All I can suggest is putting the full path in the cronjob, so:

*/10 * * * * /usr/bin/borgmatic

Thanks Tom.

Looking at the installation instructions, you either install borgmatic for system-wide backups, using sudo, or, alternatively, tp backup those items owned by “you” (probably user osmc). If you want to run a system-wide backup, you’ll need to run it under user root. That will probably also affect the location of the config file.

To see what might be going wrong, you need to send any output to a file. For now, amend the crontab entry to read:

*/10 * * * * /usr/bin/borgmatic >/tmp/borg.log 2>&1

hmm, I want to backup files that reside on an external HDD. I also tried it w/ sudo crontab and w/ the path above. I also had a log file defined but nothing has been written … I’ll try it again…

joy, I’m now calling a bash script from w/in cron and it seems to work. Next I’ll try a dry run directly.
Everything works now, I got no idea what went wrong in the first place. Most likely a mishap w/ crontab syntax, like missing out an * …

1 Like