@@ -121,6 +121,7 @@ def setup_utilities(parser):
121121 # misc
122122 parser .add_argument ("--backup" , default = False , action = "store_true" ,
123123 help = "Take backup of database in backup folder [--with_files]" )
124+ parser .add_argument ("--delete_older_than" , default = 6 , type = int , help = "delete backup older than" )
124125 parser .add_argument ("--move" , default = False , action = "store_true" ,
125126 help = "Move site to different directory defined by --dest_dir" )
126127 parser .add_argument ("--dest_dir" , nargs = 1 , metavar = "DEST-DIR" ,
@@ -353,10 +354,10 @@ def watch():
353354 webnotes .build .watch (True )
354355
355356@cmd
356- def backup (site = None , with_files = False , verbose = True , backup_path_db = None , backup_path_files = None ):
357+ def backup (site = None , with_files = False , verbose = True , backup_path_db = None , backup_path_files = None , delete_older_than = 6 ):
357358 from webnotes .utils .backups import scheduled_backup
358359 webnotes .connect (site = site )
359- odb = scheduled_backup (ignore_files = not with_files , backup_path_db = backup_path_db , backup_path_files = backup_path_files )
360+ odb = scheduled_backup (older_than = delete_older_than , ignore_files = not with_files , backup_path_db = backup_path_db , backup_path_files = backup_path_files )
360361 if verbose :
361362 from webnotes .utils import now
362363 print "database backup taken -" , odb .backup_path_db , "- on" , now ()
0 commit comments