2013-07-24 69 views
0

我使用工頭導出來創建upstart腳本(在Ubuntu上)。工頭產生像一個暴發戶的腳本:工頭和PATH環境變量

start on starting app 
stop on stopping app 
respawn 

exec su - ubuntu -c ... 

問題:啓動應用程序之前,我需要運行一大堆的改變環境(包括路徑)的腳本。但是,在ubuntu上執行su/sudo來重置PATH。而且,我的應用程序不能在沒有腳本設置的PATH的情況下運行。有沒有什麼解決方法?

+0

實際上是一個選擇,在啓動前的腳本執行腳本呢工作。 – rmonjo

回答

1

您也可以使用「命令-E」

-E   The -E (preserve environment) option indicates to the security 
       policy that the user wishes to preserve their existing 
       environment variables. The security policy may return an error 
       if the -E option is specified and the user does not have 
       permission to preserve the environment.