How do I start an Envoy task using a tty?
I am using Laravel Envoy library for deployment. When I get to the end of the deployment, I need to change a bunch of files; for this I need to switch to the root user, because chown
and chmod
do not work as an unprivileged user.
How do I get Envoy to start a specific server with a tty to make it sudo chown ...
work?
+3
source to share
1 answer
I used the following code to run privileged commands through the messenger. I'll give an example of chown but add what you want after -S
@task('mytask', ['on' => 'myserver'])
echo "{{ $password}}" | sudo -S chown 644 /myfile
@endtask
And start with
envoy run mytask --password=mypass
+1
source to share