代码之家  ›  专栏  ›  技术社区  ›  Nathan

厨师长-即使被通知也没有被执行?

  •  0
  • Nathan  · 技术社区  · 6 年前

    我已经检查了几次这个代码,我不知道为什么extract\u presta块没有被触发。我已经确认我要查找的文件不在/var/www/html目录中:c)

    我想要达到的是:

    • 下载一个文件,解压它,但只有当一个特定的文件不存在
    • 下载后停止apache,解压文件
    • 启动apache

    请给我一些建议好吗?谢谢。

    service "apache" do
      action :nothing
    end
    
    execute 'extract_presta' do
      command 'unzip /tmp/prestashop_1.7.4.2.zip'
      cwd '/var/www/html'
      not_if { File.exists?("/var/www/html/autoload.php") }
      action :nothing
      notifies :start, "service[apache]"
    end
    
    # Fetch the file. Maybe the file won't be fetched because of not_if or checksum.
    # In that case apache won't be stopped or started, it will just keep running.
      remote_file "/tmp/prestashop_1.7.4.2.zip" do
      source "https://download.prestashop.com/download/releases/prestashop_1.7.4.2.zip"
      notifies :stop, "service[apache]", :immediately
      notifies :run, 'execute[extract_presta]', :immediately
    end
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   coderanger    6 年前

    下载是否已经存在?如果是,那么 remote_file