2017-01-05 51 views
0

在我DIY的Java我有這個在我的action_hooks啓動外殼Openshift DIY的Java

cd $OPENSHIFT_DATA_DIR 

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0 
export PATH=$JAVA_HOME/bin:$PATH 

libs="libs" 

export LIB=$OPENSHIFT_REPO_DIR$libs 

src="src" 

export JAVA_FILES=$OPENSHIFT_REPO_DIR$src 

export MATCHFACES=$OPENSHIFT_REPO_DIR$src/matchfaces 


cd $OPENSHIFT_REPO_DIR 

if [[ -z "$OPENSHIFT_INTERNAL_IP" ]]; then export  OPENSHIFT_INTERNAL_IP="$OPENSHIFT_DIY_IP"; fi 
if [[ -z "$OPENSHIFT_INTERNAL_PORT" ]]; then export OPENSHIFT_INTERNAL_PORT="$OPENSHIFT_DIY_PORT"; fi 

nohup dir $LIB > ${OPENSHIFT_DIY_LOG_DIR}/output1.log 2>&1 & 

nohup javac -classpath .;$LIB/JavaBridge.jar;$LIB/FaceSDK.jar;$LIB/jna.jar $MATCHFACES/*.java > ${OPENSHIFT_DIY_LOG_DIR}/compile.log 2>&1 & 

nohup java -classpath .;$LIB/JavaBridge.jar;$LIB/FaceSDK.jar;$LIB/jna.jar $MATCHFACES/Listener > ${OPENSHIFT_DIY_LOG_DIR}/Listener.log 2>&1 & 

,但上面的代碼給我pemission被拒絕的錯誤。從上面的shell中,我試圖訪問我上傳到我的存儲庫的libs文件夾,該文件夾包含我的Java應用程序需要的外部依賴關係。任何人都可以解釋爲什麼以及如何擺脫這個錯誤。

誤差S下方

遠程:/var/lib/openshift/586b985a89f5cfe9fa0000bc/app-root/runtime/repo//.openshift/action_hooks/start:線32:的/ var/lib中/ openshift /586b985a89f5cfe9fa0000bc/app-root/runtime/repo/libs/JavaBridge.jar:權限被拒絕 remote:/var/lib/openshift/586b985a89f5cfe9fa0000bc/app-root/runtime/repo//.openshift/action_hooks/start:line 32: /var/lib/openshift/586b985a89f5cfe9fa0000bc/app-root/runtime/repo/libs/FaceSDK.jar:權限被拒絕

回答

0

自動好像CUS在執行期間,自定義文件夾中的tom文件在運行時沒有被賦予執行權限。我通過在y libs文件夾上運行 ls -l來實現此目的。

所以我通過啓動shell腳本將此代碼添加到此處以解決此錯誤。

#!/bin/bash 
# The logic to start up your application should be put in this 
# script. The application will work only if it binds to 
# $OPENSHIFT_DIY_IP:8080 
# nohup $OPENSHIFT_REPO_DIR/diy/testrubyserver.rb $OPENSHIFT_DIY_IP $OPENSHIFT_REPO_DIR/diy |& /usr/bin/logshifter -tag diy & 


cd $OPENSHIFT_DATA_DIR 

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0 
export PATH=$JAVA_HOME/bin:$PATH 

libs="libs" 

export LIB=$OPENSHIFT_REPO_DIR$libs 

src="src" 

export JAVA_FILES=$OPENSHIFT_REPO_DIR$src 

export MATCHFACES=$OPENSHIFT_REPO_DIR$src/matchfaces 
# the below is not working 
# export CLASSPATH=$OPENSHIFT_REPO_DIR/bin:$OPENSHIFT_REPO_DIR/libs/FaceSDK.jar:$OPENSHIFT_REPO_DIR/libs/jna.jar:$OPENSHIFT_REPO_DIR/libs/JavaBridge.jar 

cd $LIB 

# Giving read write and execute permissions to JavaBridge.jar for user role 
    chmod u+r JavaBridge.jar 

chmod u+w JavaBridge.jar 

chmod u+x JavaBridge.jar 

# Giving read write and execute permissions to JavaBridge.jar for groups role 
chmod g+r JavaBridge.jar 

chmod g+w JavaBridge.jar 

chmod g+x JavaBridge.jar 

# Giving read write and execute permissions to JavaBridge.jar for Others role 
chmod o+r JavaBridge.jar 

chmod o+w JavaBridge.jar 

chmod o+x JavaBridge.jar 

# Giving read write and execute permissions to FaceSDK.jar for user role 
chmod u+r FaceSDK.jar 

chmod u+w FaceSDK.jar 

chmod u+x FaceSDK.jar 

# Giving read write and execute permissions to FaceSDK.jar for groups role 
chmod g+r FaceSDK.jar 

chmod g+w FaceSDK.jar 

chmod g+x FaceSDK.jar 

# Giving read write and execute permissions to FaceSDK.jar for Others role 
chmod o+r FaceSDK.jar 

chmod o+w FaceSDK.jar 

chmod o+x FaceSDK.jar 

# Giving read write and execute permissions to jna.jar for user role 
chmod u+r jna.jar 

chmod u+w jna.jar 

chmod u+x jna.jar 

# Giving read write and execute permissions to jna.jar for groups role 
chmod g+r jna.jar 

chmod g+w jna.jar 

chmod g+x jna.jar 

# Giving read write and execute permissions to FaceSDK.jar for Others role 
chmod o+r jna.jar 

chmod o+w jna.jar 

chmod o+x jna.jar 

nohup ls -l > ${OPENSHIFT_DIY_LOG_DIR}/output1.log 2>&1 & 


cd $OPENSHIFT_REPO_DIR 

if [[ -z "$OPENSHIFT_INTERNAL_IP" ]]; then export OPENSHIFT_INTERNAL_IP="$OPENSHIFT_DIY_IP"; fi 
if [[ -z "$OPENSHIFT_INTERNAL_PORT" ]]; then export OPENSHIFT_INTERNAL_PORT="$OPENSHIFT_DIY_PORT"; fi 

# nohup dir $LIB > ${OPENSHIFT_DIY_LOG_DIR}/output1.log 2>&1 & 

nohup javac -classpath .;$LIB"/JavaBridge.jar;"$LIB"/FaceSDK.jar;"$LIB"/jna.jar" $MATCHFACES/*.java > ${OPENSHIFT_DIY_LOG_DIR}/compile.log 2>&1 & 

nohup java -classpath .;$LIB"/JavaBridge.jar;"$LIB"/FaceSDK.jar;"$LIB"/jna.jar" $MATCHFACES/Listener > ${OPENSHIFT_DIY_LOG_DIR}/Listener.log 2>&1 & 

# nohup java -cp bin test.MyHttpServer > ${OPENSHIFT_DIY_LOG_DIR}/MyHttpServer.log 2>&1 &