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 config
|
||||||
|
import errno
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@ -139,5 +140,16 @@ if __name__ == '__main__':
|
|||||||
sys.stdout.write('\n' + 80 * '-' + '\n')
|
sys.stdout.write('\n' + 80 * '-' + '\n')
|
||||||
if did_nothing:
|
if did_nothing:
|
||||||
help_msg()
|
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:
|
else:
|
||||||
help_msg()
|
help_msg()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user