2017-09-03 73 views
0

我在/etc/environmentRAILS_ENV='production'變量設定,以及簡單的bash腳本monit的和/ etc /環境

#!/bin/bash 
printenv 

在monit的配置我檢查這個腳本正在運行。(這僅是用於測試目的,因爲沒有過程是這樣,monit的應儘量與啓動:

start program = "/home/deploy/www/laptophits/current/bin/importer"

我monit的日誌中獲取的錯誤:

[UTC Sep 3 09:31:50] error : 'importer' failed to start (exit status 0) -- /home/deploy/www/laptophits/current/bin/importer: MONIT_DATE=Sun, 03 Sep 2017 09:31:20 
MONIT_HOST=localhost 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 
PWD=/ 
LANG=en_US.UTF-8 
MONIT_PROCESS_PID=-1 
MONIT_EVENT=Started 
MONIT_PROCESS_MEM 

所以它看起來像這個bash腳本只運行一些簡單的monit變量。我如何才能使它與/etc/variables和/或用戶變量一起運行?

回答

0

您可以運行你的命令:

start program = "/bin/bash -c '/home/deploy/www/laptophits/current/bin/importer'" as uid **username** and gid **group** 

shell將讀取用戶的環境。