In my fabfile.py I am making a directory:
sudo('mkdir mysite')
I want to check if this site exists then I want to move it to mysite_bkup
and create mysite
env.path = '/var/www/html/{}'.format(env['project_name'])
if exists(env.path):
sudo("mv %(path)s %(path)s + '_bkup'" % env)
But its giving me error... How can I change the name of it..
Thank you
I did it like this:
backup = env.path + '_bkup'
print backup
if exists(env.path):
if exists(backup):
sudo('rm -rf {}'.format(backup))
sudo('mv {} {}'.format(env.path, backup))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.