Symlink current added for backups
This commit is contained in:
parent
be3dda31de
commit
108a993532
12
mysync
12
mysync
@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
import config
|
||||
import errno
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@ -139,5 +140,16 @@ if __name__ == '__main__':
|
||||
sys.stdout.write('\n' + 80 * '-' + '\n')
|
||||
if did_nothing:
|
||||
help_msg()
|
||||
elif config.backup:
|
||||
src = os.path.join(basepath, timestamp)
|
||||
dst = os.path.join(basepath, 'current')
|
||||
try:
|
||||
os.symlink(src, dst)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST:
|
||||
os.remove(dst)
|
||||
os.symlink(src, dst)
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
help_msg()
|
||||
|
Loading…
x
Reference in New Issue
Block a user