#1  
Old 18th September 2008, 14:31
bschultz bschultz is offline
Senior Member
 
Join Date: Jul 2006
Posts: 221
Thanks: 11
Thanked 10 Times in 10 Posts
Default Cron Job Question

I'm trying to set up a cron job. Here's my problem: I need to download something on my server...and then send that file (an mp3) to a second server. BUT, I'm having some firewall problems on the second server's domain (and I don't control that firewall!). I can't get in directly to the final destination machine. I need to ssh into the firewall...and then ssh into the final destination on that domain.

Here's what I have so far:

Code:
#!/bin/sh
set -e

cd /downloads/
rm *.mp3
wget -nd -r -l1 --no-parent --no-passive-ftp -A.mp3 'ftp://user:password@server1'
ssh server2.com
sleep 10
ssh 192.168.2.245 (this is the final destination, which is on the LAN of server2.com)
sleep 10
/getdownloads.txt
Now, you might ask, why not download the mp3 directly to the final destination machine? I'd love to, but behind that firewall, I can't connect to that ftp site.

When I ssh into server2.com, the script above stops. Is what I'm trying to do possible? If so, what needs to be changed?

Thanks!

Last edited by bschultz; 18th September 2008 at 14:39.
Reply With Quote
Sponsored Links
  #2  
Old 18th September 2008, 14:37
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

Why don't you open one session to the firewall that portforwards to the inside machine.

then your second connection can connect to the forwarded port which sends you direct to the inside machine.
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #3  
Old 18th September 2008, 15:34
bschultz bschultz is offline
Senior Member
 
Join Date: Jul 2006
Posts: 221
Thanks: 11
Thanked 10 Times in 10 Posts
Default

What? Can you give an example please?
Reply With Quote
  #4  
Old 18th September 2008, 15:39
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

Okay this is how u do it, you can create a config file ~/.ssh/config

Code:
Host firewall
Hostname firewall_ip_address
Localforward 2222 host_behind_firewall:22
Then ssh firewall, this will create a socket bound to localhost port 2222

When you
Code:
ssh -P 2222 localhost
You will be sent to the machine behind the firewall then u can run the commands on it.

Or you can do it on the command line ssh firewall -L 2222 host_behind_firewall_ip:22
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #5  
Old 18th September 2008, 16:21
bschultz bschultz is offline
Senior Member
 
Join Date: Jul 2006
Posts: 221
Thanks: 11
Thanked 10 Times in 10 Posts
Default

Thanks for the help, topdog. I can't get past the firewall, though. Not sure what it's doing...and since I don't control it, not much I can do.

Would it make more sense to run the cron job on the final destination machine and then ssh into my server...and then scp the files back to the final destination? I can get from the final machine to my server through that firewall...just not to the ftp site to download the mp3s.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron job failure report torusturtle General 5 18th July 2008 14:13
wget cron job bschultz Programming/Scripts 9 12th September 2007 18:53
Dynamic IP and cron job satimis Server Operation 11 19th December 2006 14:34
cron job modified after upgrading V 2.2.5 jfruano Installation/Configuration 1 21st July 2006 12:31
Scheduling a cron job Rocky Installation/Configuration 1 5th March 2006 01:06


All times are GMT +2. The time now is 14:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.