using curl in a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using curl in a script
# 1  
Old 04-22-2010
using curl in a script

Hello everyone

I'm currently using a script to upload files (different file names, but same date) to an ftp server (see below)

Code:
#!/bin/sh

# Set the variables
HOST=<host>
USER=<user>
PASSWD=<password>

ftp -i -n $HOST <<END_SCRIPT 
user ${USER} ${PASSWD}
mput cbl_client_interface_${DATE}.csv
quit
END_SCRIPT

exit 0

Now I've been given the task to use the "ftps" protocol to upload the files. I've been advised to use the "curl" utility.

It is possible to use curl with ftps to transfer files like in the example above?

P.S. I'm using Solaris 10
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Curl not accepting spaces in script via variables

Hi All, I'm trying to run a script which issues rest commands via curl to an endpoint. If I put spaces in fields via something like insomnia, it works, but when I try from an input file, it's failing with a json error. while IFS=, read mname oname <------ my input file... (10 Replies)
Discussion started by: say170
10 Replies

2. Shell Programming and Scripting

Using curl in bash script

Hello. I have pick up a script from internet to track errors from curl command. #!/bin/bash # URL_TO_TEST="http://www.xxxxxx.yyy" MY_VAR=curl_init("$URL_TO_TEST") ; curl_setopt($MY_VAR, CURLOPT_HEADER, 1); curl_setopt($MY_VAR, CURLOPT_RETURNTRANSFER, 1); curl_setopt($MY_VAR,... (2 Replies)
Discussion started by: jcdole
2 Replies

3. Shell Programming and Scripting

Script containing Curl doesn't run with crontab

Hello I have a problem with the crontab command when I run a code containing Curl on the command line it runs without fail but as soon as I program it with crontab it executes everything except the curl returns fail thank you for helping me to resolve this problem because since Monday I look... (14 Replies)
Discussion started by: beautymind
14 Replies

4. Shell Programming and Scripting

Rest APIs without curl in shell script

We are not allowed to install curl on our linux box. Is there any other way to talk to Rest API's in shell script rather than using curl ? - Please advise - thank you (3 Replies)
Discussion started by: rv_champ
3 Replies

5. Shell Programming and Scripting

Using CURL in a script

Hi all so I'm new to scripting but I am making a script that is a url shortener. It will take a url off the command line and spit back the shortened version using bit.ly's api this is what I have so far if then echo "You must supply a URL." exit 1 fi read url... (3 Replies)
Discussion started by: subway69
3 Replies

6. Shell Programming and Scripting

curl into a shell script (variable transmission): need help

Hey I'm writting a little shell script, and I started using curl with it today. I would like to login into a website using curl (--data argument). This part is working, curl sent me the webpage that we see when we log in this website. Problem: This is a temporary page. When I log in this... (0 Replies)
Discussion started by: Link_
0 Replies

7. Shell Programming and Scripting

curl ftp script

Hello - I'm a novice, so apologies if this is a stupid/answered question. I'm operating on a mac, and I'm using ftp to transfer files to my computer. The files have atypical names, although I have a list of them, addresses included. Is there a way to automate this using curl? That is to... (3 Replies)
Discussion started by: Qroid
3 Replies

8. Shell Programming and Scripting

Bash script idea using cUrl -- possible?

I have an alias already in my .bash_profile to download files using cUrl's -o (output to file, user provides the file name) option. I find I'm using it quite a bit, so I wanted to write a script to run "curl -o", taking the necessary inputs - file name and URL from which to download - and then... (3 Replies)
Discussion started by: SilversleevesX
3 Replies

9. Shell Programming and Scripting

using curl with shell script.

hi please help me out here, i want to use curl command in shell script to test web pages, what i have is an opening page, when i click on a button on opening page, the next page comes up and then i have to upload a file n then click another button to submit and then comes the output... (0 Replies)
Discussion started by: ankushg002
0 Replies

10. Shell Programming and Scripting

script to output curl result as html

hi, new to scripting and would like to know how can I have a script which will curl a few URLs and have the results such as the URLs being curled, dns lookup time, connection time, total time, etc save in a html format in a form of table with column and rows. thank you. (4 Replies)
Discussion started by: squidusr
4 Replies
Login or Register to Ask a Question
pure-uploadscript(8)						     Pure-FTPd						      pure-uploadscript(8)

NAME
pure-uploadscript - Automatically run an external program after a successful upload SYNTAX
pure-uploadscript [-p </path/to/pidfile>] [-B] [-g <gid>] [-h] -r <program to run> [-u <uid>] DESCRIPTION
If Pure-FTPd is compiled with --with-uploadscript (default in binary distributions), and if the -o (or --uploadscript) is passed to the server, a named pipe called /var/run/pure-ftpd.upload.pipe is created. You will also notice an important file called /var/run/pure-ftpd.upload.lock, used for locking. After a successful upload, the file name is written to the pipe. pure-uploadscript reads this pipe to automatically run any program or script to process the newly uploaded file. OPTIONS
-B Daemonize the process and fork it in background. -g <gid> Switch the group ID to <gid>. -h or --help Display available options. -r <program to run> Tell what program/script to run. It has to be an absolute filename, the PATH environment variable is ignored. The first argument of that program will be the unquoted name of the newly uploaded file. Environment variables aren't cleared. So don't put sensitive data in them before calling pure-uploadscript if you switch uid. -u <uid> Switch the user ID to <uid>. ENVIRONMENT
When the upload script is run, the name of the newly uploaded file is the first argument passed to the script (referenced as $1 by most shells) . Some environment variables are also filled by useful info about the file. UPLOAD_SIZE The size of the file, in bytes. UPLOAD_PERMS The permissions, as an octal integer. UPLOAD_UID The numerical UID of the owner. UPLOAD_GID The numerical GID of the owner. UPLOAD_USER The login of the owner. UPLOAD_GROUP The group name the files belongs to. UPLOAD_VUSER The full user name, or the virtual user name (127 chars max) . FILES
/var/run/pure-ftpd.upload.pipe /var/run/pure-ftpd.upload.lock /var/run/pure-uploadscript.pid SECURITY
pure-ftpd and pure-uploadscript are trying to limit security implications of such a feature. - The pipe can only be created and opened by root. It must have perms 600, with uid 0, or it will be ignored. - The argument passed to an external program/script is always an exact absolute path name. It doesn't get fooled by chroot()ed environ- ments, and by absolute or relative paths added to the STOR command. - UID and GID are set just after parsing command-line options, and pure-uploadscript never gets back supervisor privileges. - Descriptors to the pipe are never passed to external programs/scripts. So when UID switched, the target user can't mess the pipe. - Only regular files are processed, control characters are rejected, and a header+footer avoid partial file names. - Two external programs/scripts can't run at the same time. Uploads are always processed sequentially, in chronological order. This is to avoid denial-of-services by issuing a lot of simultaneous STOR commands in order to launch a fork bomb on the server. For this reason, your programs shouldn't take a long time to complete (but they can run themselves in background) . EXAMPLES
A sample script could be : #! /bin/sh echo "$1 uploaded" | /usr/bin/mutt -s "New upload : $1" ftpadmin@dom.ai.n Never forget to quote ("variable") all variables in all your shell scripts to avoid security flaws. AUTHORS
Frank DENIS <j at pureftpd dot org> SEE ALSO
ftp(1), pure-ftpd(8) pure-ftpwho(8) pure-mrtginfo(8) pure-uploadscript(8) pure-statsdecode(8) pure-pw(8) pure-quotacheck(8) pure-authd(8) RFC 959, RFC 2228, RFC 2389 and RFC 2428. Pure-FTPd team 1.0.36 pure-uploadscript(8)