Tôi có lệnh service app start-demo
yêu cầu tôi nhập sudo service app start-demo
trong dòng lệnh.thực hiện như sudo trong vải
tôi đã sử dụng sudo(service app start-demo)
và sudo(sudo service app start-demo)
nhưng tôi vẫn nhận được
Cảnh báo: sudo() gặp phải một lỗi (trả lại mã 1) trong khi thực hiện 'ứng dụng dịch vụ sudo bắt đầu-demo'
Tôi không có vấn đề thực hiện mà như một dòng lệnh trong một thiết bị đầu cuối.
Tôi không chắc chắn nếu SADeprecationWarning:
được tính là không thể vải?
Cảm ơn.
[email protected]:/var/lib/app$ fab kickstart
You are installing prereqs..........
### Install Prereqs for Populate ###
No hosts found. Please specify (single) host string for connection: localhost
[localhost] Login password:
### I am starting demo ###
[localhost] sudo: sudo service app start-demo
[localhost] out: Starting demo
Fatal error: sudo() encountered an error (return code 1) while executing 'sudo service app start-demo'
Aborting.
Disconnecting from localhost... done.
mã
def pserve():
print '### I am starting demo ###'
#with settings(warn_only=True):
sudo('sudo service app start-demo')
#sudo('service app start-demo')
hoặc lệnh sudo
sẽ thất bại.
/etc/sudoers
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
# Members of the admin group may gain root privileges
%admin ALL=(ALL) NOPASSWD:ALL
Cấu hình 'sudo' của bạn có yêu cầu bạn nhập mật khẩu tại thiết bị đầu cuối không? – sarnold
Bạn đã đặt lệnh trong dấu ngoặc kép chưa? Nó phải là 'sudo (" dịch vụ ứng dụng bắt đầu-demo ")'. – mayhewr
@sarnold Nó không. Khi tôi làm 'sudo' trên thiết bị đầu cuối, nó sẽ không hỏi. Tôi chạy như fab nó đã không yêu cầu một trong hai. – user423455