mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.34k stars 491 forks source link

sudo systemctl restart apache2 #598

Closed kickbk closed 4 years ago

kickbk commented 6 years ago

How would you go about restarting apache? running command 'sudo systemctl restart apache2' hangs as it's waiting for a password. My scripts deploys to multiple domains with multiple passwords (same SSH key though).

I do have: set :ssh_options, "-A" and I can add set :forward_agent, true

I realize echoing the password into sudo with -S (echo <password> | sudo -S ...) would work, but it's ugly.

In case you're wondering, I need to restart Apache2 after I deploy since I have symlinks that get screwed up when a new deploy is pushed.

I'm open minded about somehow getting Apache to realize the changes without restarting it, and any other way to restart it if I must.

Help is much appreciated!

d4be4st commented 6 years ago

I would add those commands to use passwordless sudo:

https://askubuntu.com/a/159009