January 2019
Beginner
318 pages
8h 23m
English
This is the most important work system administrators have to do. In this section, we will learn about making backups using rsync. The rsync command is used for copying files and directories locally, as well as remotely, and performing data backups using rsync. For that, we are going write a script called take_backup.py and write the following code in it:
import osimport shutilimport timefrom sh import rsyncdef check_dir(os_dir): if not os.path.exists(os_dir): print (os_dir, "does not exist.") exit(1)def ask_for_confirm(): ans = input("Do you want to Continue? yes/no\n") global con_exit if ans == 'yes': con_exit = 0 return con_exit elif ans == "no": con_exit = 1 return con_exit else:1 print ("Answer with yes or ...Read now
Unlock full access