执行脚本的敏感sudo密码是必需的
我有一个敏感的处理程序,在一个终结点Linux机器上被触发(Centos 6.6。这里是我正在使用的脚本: #!/bin/bash –login sudo -n -u deploy bash –login -c "cd /var/www/vhosts/sc/current; pwd; BUNDLE_GEMFILE=/var/www/vhosts/sc/current/Gemfile RAILS_ENV=production bundle exec pumactl -F /var/www/vhosts/sc/shared/config/puma.rb stop " sudo -n -u deploy bash –login -c "cd /var/www/vhosts/sc/current; pwd; BUNDLE_GEMFILE=/var/www/vhosts/sc/current/Gemfile RAILS_ENV=production bundle exec pumactl -F /var/www/vhosts/sc/shared/config/puma.rb start " 作为另一个用户在本地运行这个脚本工作正常,我可以让美洲狮重新启动。 即使我给了一个shell并在端点上执行脚本。 当它从sensu服务器触发时,我得到的输出: {"timestamp":"2016-04-18T16:45:17.581962-0500","level":"info","message":"handler output","handler":{"type":"pipe","command":"/bin/sh /etc/sensu/handlers/puma_restart.sh","name":"puma_restart"},"output":["sudo: a password is required\n","sudo: a password is […]