FTP Photo using Linux script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP Photo using Linux script
# 1  
Old 04-15-2014
FTP Photo using Linux script

Please provide sample linux shell script to retrieve a photo from a Panasonic Security camera using a http command and then transfer to ftp server. I am using Linux O/S 2.6.32 KERNEL

Script steps:
Retrieve still picture from a Panasonic camera using the following http command alarmserver/cgi-bin/camera?resolution=1920 This command will retrieve a still picture from my Panasonic camera and display it in my browser. I am able to use the browser “Save As” command to save this picture as a .jpg file. The default photo file name is camera.jpg, but I want the file name to be Bus1+<current date and time>.jpg

Transfer this picture to my windows FTP server site “EventPhotos” at 10.0.0.51
User: busprotect
Password: busprotect
The picture name should be Bus1+<current date and time>.jpg
# 2  
Old 04-15-2014
Perhaps something like this:

Code:
#!/bin/bash
#
#

# set the url to the security camera
url="<insert url to camera image here>"

# create a temp directory to hold the downloaded
# images
tmpDir="/tmp/camphotos"
if [ ! -d $tmpDir ]
then
    mkdir $tmpDir
fi

# use curl command to fetch the file and rename it
# on the fly
cd $tmpDir
curl -L -o Bus1+$(date +'%m%d%Y_%T').jpg -C - $url

# store the name of the file we just downloaded
new_image=$(ls -ltr $tmpDir | tail -n1 | awk '{print $NF}')

# use curl to upload it to ftp server
curl -u busprotect:busprotect -T $new_image ftp://10.0.0.51/

# done
exit 0

76c8abfb508c3ff189fd695be44b05e3
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script to ftp in to linux then pass reply

Hello, I have an ftp loop script which I was going to use to login to various Linux systems but as It's my first connection I'm being prompted to add it to the known_hosts. Can this script be modified to reply 'yes' before passing the user/pass ? usname="someuser" pass="somepass" while read... (1 Reply)
Discussion started by: Grueben
1 Replies

2. UNIX for Advanced & Expert Users

ftp in shell script from linux to windows XP

Hi, I have 9 different linux based servers and i am automating there healthcheckup by doing ssh and fetching deviations out of it in a single text file. I am doing so by using ssh keygen. I am done with the above part . Now i want to ftp that text file to my windows XP desktop and i want to... (4 Replies)
Discussion started by: gemnian.g
4 Replies

3. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

4. UNIX for Dummies Questions & Answers

ascii FTP from Linux to Linux adding carriage returns

Hi, I've got an issue with a shell script that FTP's a file from one Linux server to another Linux server. My script runs on a Linux server and creates an output file (from a database call), and then FTP's this file to another Linux server. The problem is that, even though the output file... (0 Replies)
Discussion started by: roysterdoyster
0 Replies

5. Shell Programming and Scripting

passing parameter to ftp script from output of another ftp

Hi, I have a ftp script which first gets all the file names and echo's the latest file. I'm using another ftp command sets to get the file name given by first ftp. The problem is the parameter is not accepted by second ftp. The error message i'm getting is > Rename Temp File calloc:ICMP... (5 Replies)
Discussion started by: ammu
5 Replies

6. Shell Programming and Scripting

FTP from Linux to windows server by shell script

Hi, Please advice whether my below requirement is feasible, My requirement : Automated FTP from linux server to windows server using a shell script on every monday. If feasible, please help me how to do this ? Thanks in advance (2 Replies)
Discussion started by: apsprabhu
2 Replies

7. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies
Login or Register to Ask a Question