shallow-backup
shallow-backup copied to clipboard
Backup crontab file
I thought a backup of the users crontab file would be nice as well. I'll create a PR for it.
If you want to work on a different crontab related feature after: I explored adding a cronjob for running shallow backup but never got around to it. Should be pretty simple, but still cool.
Currently i've just added shallow-backup to the crontab file of my mac.
Looks like this.
0 20 * * * osascript -e 'tell application "Terminal" to do script "shallow-backup -all"'
It opens a terminal window running shallow-backup everyday at 8pm.
But I guess a builtin cron functionality would be nice as well.
Yeah. There should really be a "Set up cronjob" option in the main menu or something.
@AlexanderProd Any update on this PR?
A quick dirty fix of this is adding crontab -l > ~/.config/crontab to the shallow-backup wrapper script (described in the README), and then adding ~/.config/crontab to your list of paths to backup.
I wasn't sure where to put the crontab output and because I don't think it deserves its own function I'd propose just adding this code to the backup_configs function. After all the crontab is a config too.
command = "crontab -l"
dest = "{}/crontab.txt".format(backup_path)
run_cmd_write_stdout(command, dest)