Monday, 19 August 2013

fabric run command as root automaticly

fabric run command as root automaticly

i have some freebsd servers and don't have sudo. But i want to run some
command automaticly with root just like the following command:
def autodeploy(url):
with cd('/tmp'):
if not exists('releasetar.sh'):
put('/tmp/releasetar.sh', 'releasetar.sh', mode=0644)
run("wget '{}'".format(url))
run('su - -m -c "cd /tmp && bash /tmp/releasetar.sh"')
the su with -c option worked to linux but didn't worked on freebsd. How
can i solved this problem ? I'm wish your solution can both worked on
linux and freebsd. Thank you for your answer~~

No comments:

Post a Comment