You are not logged in. This forum allows only logged in users to post. If you want to post in the forum, please log in.
Download
Magazine
Develop
Account
Download
Magazine
Develop
Login
Forgot Account/Password
Create Account
Language
Help
Language
Help
×
Login
Login Name
Password
×
Forgot Account/Password
Category:
Software
People
PersonalForge
Magazine
Wiki
Search
OSDN
>
Find Software
>
System
>
Networking
>
Monitoring
>
Hinemos
>
Forums
>
FAQ
>
Hinemosのジョブコマンドについて
Hinemos
Description
Project Summary
Developer Dashboard
Web Page
Developers
Image Gallery
List of RSS Feeds
Activity
Statistics
History
Downloads
List of Releases
Stats
Communication
Forums
List of Forums
ヘルプ (221)
トラブルシューティング (124)
FAQ (209)
公開討議 (16)
動作確認情報 (26)
Mailing Lists
list of ML
hinemos-mailing-list
News
Forums:
FAQ
(Thread #41003)
Return to Thread list
RSS
Hinemosのジョブコマンドについて (2019-07-29 09:54 by
ggctaf
#83309)
linuxサーバにあるbashのシェルスクリプトをHinemosのジョブコマンドを使用して、rootユーザで実行したいのですが、なにか良い方法はありますでしょうか?
目的としましては、rootで設定してある.bash_profileの環境変数をシェルスクリプトで使用しており、
その設定を使用して起動したいと思っています。
(Last Update: 2019-07-29 19:33 by
ggctaf
)
Re: Hinemosのジョブコマンドについて (2019-07-31 09:44 by
nonono
#83323)
hinemosエージェントサービスはsystemd経由で起動されますが、systemdは.bash_profileを読みに行かないみたいですね。
なので、.bash_profileで指定した環境変数を利用するシェルスクリプトは、そのままでは正常に実行することができないです。
このようなスクリプトをジョブから実行する場合は、.bash_profileを読み込む処理を別途行う必要があります。
方法は色々あるかと思いますが、一番単純なのは、ジョブの「コマンド」の指定を以下のように修正するところでしょうか。
(修正前)
bash /tmp/script001.sh
(修正後)
source ~/.bash_profile; bash /tmp/script001.sh
当該スクリプトを何回も呼び出す場合は、スクリプト側で.bash_profileを読み込むようにした方がいいかも。
Reply to
#83309