Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run an Envoy Task with a tty?

I'm using Laravel's Envoy library for deployment. When I get to the end of deployment, I need to change a bunch of files' ownership; in order to do this, I need to switch to the root user, because chown and chmod don't work as an unprivileged user.

How do I get Envoy to run a specific server using a tty so that sudo chown ... will work?

Here's a link to my Envoy.blade.php file.

like image 234
Goldentoa11 Avatar asked May 11 '15 14:05

Goldentoa11


1 Answers

I used the following code to run privileged commands through envoy. I'll give a chown example but add what you want after -S

@task('mytask', ['on' => 'myserver'])
    echo "{{ $password}}" | sudo -S chown 644 /myfile
@endtask

And run with

envoy run mytask --password=mypass
like image 164
Dave Carruthers Avatar answered Oct 31 '22 20:10

Dave Carruthers