Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services Beanstalk:ebextensions自定义失败,找不到服务:命令_Amazon Web Services_Amazon Elastic Beanstalk - Fatal编程技术网

Amazon web services Beanstalk:ebextensions自定义失败,找不到服务:命令

Amazon web services Beanstalk:ebextensions自定义失败,找不到服务:命令,amazon-web-services,amazon-elastic-beanstalk,Amazon Web Services,Amazon Elastic Beanstalk,我正在尝试通过elasticbeanstalk堆栈中的.ebextensions安装应用程序。我跟踪医生已经有一段时间了。这是我的配置: files: "/tmp/software.sh" : mode: "000755" owner: root group: root content: | #!/bin/bash wget https://website.net/software/softwar

我正在尝试通过elasticbeanstalk堆栈中的.ebextensions安装应用程序。我跟踪医生已经有一段时间了。这是我的配置:

files:
  "/tmp/software.sh" :
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/bin/bash
      wget https://website.net/software/software-LATEST-1.x86_64.rpm
      software-LATEST-1.x86_64.rpm
      sed -i -e '$a\
      *.* @@127.0.0.1:1514;RSYSLOG_FileFormat' /etc/rsyslog.conf
      /sbin/service rsyslog restart
      /sbin/service software start
container_commands:
  01_run:
    command: "/tmp/software.sh"
应用配置时,我收到一个错误,即即使我指向/sbin/service中service命令的位置,也找不到命令“service”。我试过很多不同的方法,但我总是会犯这个错误。在主机上手动运行脚本不会出现任何问题

堆栈使用的映像是AmazonLinuxRelease2(Karoo)

具体的错误消息是:

[3744211/3744211]\n\n/tmp/[01;31m[Kalert[m[K_software.sh: line 8: service: command not found\n/tmp/[01;31m[Kalert[m[K_software.sh: line 9: service: command not found. \ncontainer_command 02_run in .eb[01;31m[Kextensions[m[K/[01;31m[Kalert[m[K-software.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":127,"events":

我的同事尝试用另一种方式安装软件,结果成功了。这就是成功的原因:

install.config>>

  01_install_software:
    command: rpm -qa | grep -qw software || yum -y -q install https://website.net/software/software-LATEST-1.x86_64.rpm
  02_update_rsyslog:
    command: sed -i -e '$a*.* @@127.0.0.1:1514;RSYSLOG_FileFormat' -e '/*.* @@127.0.0.1:1514;RSYSLOG_FileFormat/d' /etc/rsyslog.conf
  03_restart_rsyslog:
    command: service rsyslog restart
services:
  sysvinit:
    rsyslog:
      enabled: "true"
      ensureRunning: "true"
    software:
      enabled: "true"
      ensureRunning: "true"
services.config>>

  01_install_software:
    command: rpm -qa | grep -qw software || yum -y -q install https://website.net/software/software-LATEST-1.x86_64.rpm
  02_update_rsyslog:
    command: sed -i -e '$a*.* @@127.0.0.1:1514;RSYSLOG_FileFormat' -e '/*.* @@127.0.0.1:1514;RSYSLOG_FileFormat/d' /etc/rsyslog.conf
  03_restart_rsyslog:
    command: service rsyslog restart
services:
  sysvinit:
    rsyslog:
      enabled: "true"
      ensureRunning: "true"
    software:
      enabled: "true"
      ensureRunning: "true"