Hi all
i have a such question this is my shell script my script must upload file to webdav server
PHP Code:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
#!/bin/sh
### ----------------------------------------------------------------------- ###
### Get the current date string
### ----------------------------------------------------------------------- ###
CURRENT_DATE=`date "+%Y-%m-%d"`
#echo ${CURRENT_DATE}
### ----------------------------------------------------------------------- ###
### Configuration
### ----------------------------------------------------------------------- ###
SITE_NAME="blabla"
WEBDAV_NAME="blabla"
INTERFACE_NAME="blabla"
# Script Path
SCRIPT_PATH="xml_api/cci"
SCRIPT_FILE="extract_survey_data.php"
# Output Files
OUTPUT_FILE="${CURRENT_DATE}export.csv"
echo ${OUTPUT_FILE}
# Error Handling
ERROR_EMAIL_TO="some@email.com"
ERROR_EMAIL_SUBJECT="RNT to WSI Failure"
### ----------------------------------------------------------------------- ###
### fail function
### ----------------------------------------------------------------------- ###
function fail() {
echo "${1}" | mail -s ${ERROR_EMAIL_SUBJECT} ${ERROR_EMAIL_TO}
echo "Failure: $1"
exit 1
}
### ----------------------------------------------------------------------- ###
### Run the php script
### ----------------------------------------------------------------------- ###
PATH_INFO=${SCRIPT_PATH}/${SCRIPT_FILE}
export PATH_TRANSLATED=$PATH_INFO
QUERY_STRING=""
SCRIPT_NAME="/cgi-bin/${INTERFACE_NAME}.cfg/php"
REDIRECT_QUERY_STRING="${QUERY_STRING}"
REDIRECT_URL="${SCRIPT_NAME}/${PATH_INFO}"
REMOTE_ADDR=127.0.0.1
REQUEST_METHOD=GET
if [ -n "${QUERY_STRING}" ] ; then
REQUEST_URI="${REDIRECT_URL}?${QUERY_STRING}"
else
REQUEST_URI="${REDIRECT_URL}"
fi
echo ${PATH_INFO} ${QUERY_STRING} ${SCRIPT_NAME} ${REDIRECT_URL}
export PATH_INFO QUERY_STRING SCRIPT_NAME REDIRECT_QUERY_STRING REDIRECT_URL \
REMOTE_ADDR REQUEST_METHOD
### ----------------------------------------------------------------------- ###
### Replace this shell's process with PHP -- proper error reporting
### ----------------------------------------------------------------------- ###
if [ "$CHROOTED" = 1 ] ; then
cd "/cgi-bin/${INTERFACE_NAME}.cfg"
exec ./php
else
cd "/www/somename/${SITE_NAME}/cgi-bin/${INTERFACE_NAME}.cfg"
exec ./php
fi
### ----------------------------------------------------------------------- ###
### WebDAV the Files
### ----------------------------------------------------------------------- ###
env "HOME=/www/somename/${SITE_NAME}/priv_keys/" cadaver \
"https://hostingdocs.custhelp.com/fileserver/${WEBDAV_NAME}" << EOF
put /www/somename/${SITE_NAME}/tmp/${OUTPUT_FILE}
exit
EOF
my shellscript create file in
/www/somename/${SITE_NAME}/tmp/ some file and after createing it must put created file in
https://hostingdocs.custhelp.com/fileserver/${WEBDAV_NAME}
but my problem is that puting file comand dose not work
please explein me what is wrong with my put command
thanks.