Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shallow_backup/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def backup_configs(backup_path, skip=False):

# backup crontab
command = "crontab -l"
dest = "{}/crontab.txt".format(backup_path)
dest = os.path.join(backup_path, "/crontab.txt")
run_cmd_write_stdout(command, dest)


Expand Down
6 changes: 4 additions & 2 deletions shallow_backup/reinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ def reinstall_configs_sb(configs_path):
copyfile(path_to_backup, dest_path)

# reinstall crontab
with open("{0}/crontab.txt".format(configs_path), "r") as f:
with open(os.path.join(configs_path, "/crontab.txt"), "r") as f:
for x in f:
cmd = "(crontab -l ; echo \"{0}\") | sort - | uniq - | crontab -".format(x)
# the replace sanitizes the crontab line of any present " characters.
cmd = "(crontab -l ; echo \"{0}\") | sort - | uniq - | crontab -".format(
x.replace('"', '\\"'))
run_cmd(cmd)

print_section_header("CONFIG REINSTALLATION COMPLETED", Fore.BLUE)
Expand Down