Shell脚本停止在日志文件中写入

时间:2019-02-25 12:43:43

标签: shell logging

我正在处理预配器外壳脚本,该脚本在某些任务完成后会写入日志文件。问题在于,在执行第三次写入操作后,它将停止并且不记录其他任何内容,但是脚本会与其余操作一起成功运行。

我正在使用以下最简单的命令:

#!/bin/bash

set -o nounset
set -o errexit

# Set variables
APACHE_USER="www-data"
STORES_PATH="/var/www/x/stores"
LOG_FILE="deploy_store.log"

NEW_DB_PWD="$(openssl rand -base64 12)"

arg1="${1:-}"
echo "'$arg1' provision started on $(date +'%Y-%m-%d %H:%M')" >> "${LOG_FILE}"
git clone git@bitbucket.org:x/y.git ${STORES_PATH}"/$arg1"
echo "Done cloning the repository." >> "${LOG_FILE}"

# Link the store vendor folder
ln -s /srv/x/vendor_5.7 ${STORES_PATH}"/$arg1/vendor"
echo "Done linking the vendor folder." >> "${LOG_FILE}"

# Run the setup composer commands
cd ${STORES_PATH}"/$arg1" && composer dump-autoload
cd ${STORES_PATH}"/$arg1" && php artisan package:discover --ansi
cd ${STORES_PATH}"/$arg1" && php -r "file_exists('.env') || copy('.env.example', '.env');"
cd ${STORES_PATH}"/$arg1" && php artisan key:generate
echo "Done composer setup." >> "${LOG_FILE}" # THIS IS NOT LOGGED.

0 个答案:

没有答案