Signed-off-by: Luan Shengde shdluan@163.com --- container/fetch-mail/start | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 container/fetch-mail/start
diff --git a/container/fetch-mail/start b/container/fetch-mail/start new file mode 100755 index 0000000..45f3910 --- /dev/null +++ b/container/fetch-mail/start @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true + +require 'set' +require_relative '../defconfig' + +docker_rm 'fetch-mail' + +names = Set.new %w[ + FETCH_MAIL_ADDRESS + FETCH_MAIL_AUTH_CODE + FETCH_MAIL_DIR + FETCH_MAIL_BOX +] + +defaults = relevant_defaults(names) + +env = docker_env(defaults) + +cmd = %w[ + docker run + --restart=always + -u mailer + --name=fetch-mail + -d +] + env + %W[ + -v #{defaults['FETCH_MAIL_DIR']}:#{defaults['FETCH_MAIL_DIR']}:rw + -w /home/mailer/ + fetch-mail +] + +cmd += ['sh', '-c', 'sh run.sh'] + +system(*cmd)
On Wed, Dec 16, 2020 at 11:50:29AM +0800, Liu Yinsi wrote:
+cmd += ['sh', '-c', 'sh run.sh']
^^ 'sh' is unnecessary.
this sh is required, you can use sh run.sh or ./run.sh
sh -c is use to run the later string as a command.
Thanks, Luan Shengde
Thanks, Yinsi
+system(*cmd)
2.23.0