upload file to webdav server


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting upload file to webdav server
# 1  
upload file to webdav server

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 -${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 [ -"${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] ; 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.
# 2  
nobody can explain me why my put comand does not work
env "HOME=/www/mysite/folder/priv_keys/" cadaver \
*** "https://hostingdocs.custhelp.com/fileserver/remot" << EOF
put /www/mysite/folder/tmp/2009-01-23export.csv

i can put this file to my webdav server
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #501
Difficulty: Easy
If a piece of code adds two numbers together and stores the result, there should be a comment that explains the process in the source code.
True or False?

9 More Discussions You Might Find Interesting

1. Web Development

Sending file to WebDav Server

Hi All, I am using a webdav server host name : abc.xyz.com.ak username : user123 password : password123 port : 80 I need to send files stored in my windows system to the server, any idea how to do it. I dont know how to create a url in linux for webdav server using details. (2 Replies)
Discussion started by: prakhar_dubey
2 Replies

2. Proxy Server

Upload file from desktop to UNIX server via putty

I have a requirement of following - 1. Transfer excel spreadsheet from desktop to unix server 2. Open the spreadsheet and read the sql row by row at a time 3. Run each sql on database using unix and then send output back to spreadsheet that was uploaded earlier and then transfer file back to... (12 Replies)
Discussion started by: Analabhatla
12 Replies

3. Shell Programming and Scripting

Generate file and Upload to SFTP server.

Xperts, My requirement is something like this, I have a sql script which i need to embed in a shell. The sql (oracle) script will generate a .csv file in some Unix directory. the approximate file size is around 10 mb which i need to upload to an sftp server. My concern here is how to make... (5 Replies)
Discussion started by: Showdown
5 Replies

4. Shell Programming and Scripting

Script to upload latest file to other server via FTP

Hello, I have a script that finds the latest version of a file in a folder on my Minecraft server. I'm trying to come up with something that will then FTP that file over to my fileserver. Here's what I have that finds the newest file: find /home/mc/archive/sbhouse -type f -mtime +45 -exec... (7 Replies)
Discussion started by: nbsparks
7 Replies

5. Shell Programming and Scripting

Curl ftp upload success but no file exist on the server !!!!

hello, I'm trying to upload a file to this ftp server and others ftp://ftp.byethost12.com as you can see in the output of CURL using the -v option curl reports that the upload succeeded but when i connected to the server with file-zilla there is no file uploaded the same command upload files... (5 Replies)
Discussion started by: laraaj
5 Replies

6. Shell Programming and Scripting

upload on server

salmo allim warhmat allah wa brakato i face another problem with ftp protocol i have my server when upload with ftp on my server it upload when access from internet with URL can't find any thing that i get from ftp commend that upload in Current directory is /home/user name when... (5 Replies)
Discussion started by: pua06
5 Replies

7. Shell Programming and Scripting

upload excel file contents to server

Hi I have an excel file with only 5 rows .I want to uplaod those 5 rows to a database using a shell script.Is this possible.If so where do i start. Thnks (1 Reply)
Discussion started by: magikminox
1 Replies

8. Shell Programming and Scripting

stuck in perl cgi to upload a file to server

hi, i m working on a perl cgi script which uploads a file to the server. i m stuck. i hav written the errors. plz help. Sachin Kaw ______________________________________________________________________ #!/usr/bin/perl -w use CGI; use CGI qw(:standard); use strict; use POSIX... (4 Replies)
Discussion started by: sachin_kaw
4 Replies

9. UNIX for Dummies Questions & Answers

How to upload to the unix server?

I am having problems uploading files to my new server. I am new at this so im sure im doing it wrong. I tried using wsftp but that didnt work. please help me!! (4 Replies)
Discussion started by: rdog157h
4 Replies

Featured Tech Videos