Operating System - HP-UX
1822018 Members
3755 Online
109639 Solutions
New Discussion юеВ

Re: How to start job after ftp

 
Singaram
Advisor

How to start job after ftp

I would like to know how to kick off another job after ftping a file in the remote server.

I tried exec - it says invalid command.
I tried quote - it says command not uderstood.

Any suggestions?..

Thanks
Singaram
15 REPLIES 15
Alex Lavrov.
Honored Contributor

Re: How to start job after ftp

If you want to execute shell command from ftp prompt - it's impossible.

Make a script that transfers the file (ftp/rcp/scp) and then executes another jobs.
If you want to automate ftp, read here how to do it with .netrc (not very secure):
http://www.mavetju.org/unix/netrc.php

I suggest to use sftp/scp if you have ssh installed.

I don't give a damn for a man that can only spell a word one way. (M. Twain)
Robert Salter
Respected Contributor

Re: How to start job after ftp

If it's available you could use 'remsh', do a man on it to get the syntax. There's a few ways to have a job run remotely, depends on when you need it to run. On a schedule (cron) or on the fly (remsh).

If it's a scheduled job, the remote server could have a cron job setup to check for the file, execute it, then remove or rename it.

if it's an on the fly job,then see if you have rcp/remsh capabilities (with security being the big thing, possibly these aren't turned on). You could rcp the file to the remote server and then run remsh to execute it.

l8ter
Time to smoke and joke
RAC_1
Honored Contributor

Re: How to start job after ftp

What do you mean by another job after ftp??
Post the command that you are using.
There is no substitute to HARDWORK
Singaram
Advisor

Re: How to start job after ftp

I send a file using ftp to a remote server.
Then i want to kick off a job on the remote server which processes the file i just ftpied..

singaram
Alex Lavrov.
Honored Contributor

Re: How to start job after ftp

So write a script that transfers the file to the remote server and then executes a job on that file with remsh/rexec.

Or, do it from another direction, pull the file on the remote server and then execute a job.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Pete Randall
Outstanding Contributor

Re: How to start job after ftp

Sounds like a glaring, screaming security hole to me!!!


Pete

Pete
Kent Ostby
Honored Contributor

Re: How to start job after ftp

you can do it this way:

script does FTP
when FTP completes, script sends email to a dedicated user on the other machine.
ON the other machine is a script running which checks for new email. When it gets new email, it removes the email and kicks off a script to process the FTP.
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Geoff Wild
Honored Contributor

Re: How to start job after ftp

or - on remote machine - have a script that checks the ftp receive directory for new files - say every 5 minutes - if it finds one - then process it...

or - in you ftp script - remsh to remote server and execute the job you want (or ssh)....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Dave La Mar
Honored Contributor

Re: How to start job after ftp

Singaram-
There are a number of ways and syntax to use for what you are asking.
The syntax and ability to do this depends on the OS of the machine you ftp to.
Since you have not provided the OS of the remote machine, we cannot offer "good" advice.
Please be advised, as Pete mentioned, regardless of the remote OS, this type of process is a security risk.
We commonly perform tasks, such as what you ask, between a VM/VSE mainframe and unix/nt, unix to nt, nt to unix. In our environment our processes are only on the internal network, yet this is still a risk.
Please advise of the to from OS you are referring to.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Singaram
Advisor

Re: How to start job after ftp

Thanks Dave for your resply.

For 1 file the sending server and receiving servers are HP9000.

For another file the sending server is AS/400
and receiving server is HP9000.

Oldendays for HP3000 as receiving server we use site stream command. I am trying to find a equalent command of that.

I dont want to use remsh.
IF no other alternative only i should do that.

May be security issue. But this is all with our own internal servers only.

Thanks
Singaram
Dave La Mar
Honored Contributor

Re: How to start job after ftp

O.K. I know I am about to get slammed by the security police, but here you go:

For UNIX to UNIX, and AS400 to unix:
1. Your script to execute should be in the
/etc/ftpd/ftp-exec directory
2. Or to execute from the directory the script resides, use a symbolic link with the file name in the /etc/ftpd-exec directory.
i.e. dummy9 -> /home/dlamar/dummy9

Sample code for your ftp job (not using .netrc)

ftp -n -v << endl >> /home/dlamar/work/ftp.log
open server_name
user some_user some_password
syst
put /some_directory/some_file.dat
site exec dummy9
endl
exit 0

Please be advised, there are a number of ways to perform what you are asking. I am simply providing an ftp based solution that you have requested.

THIS, AS IS ANY ALLOWABLE FTP EXECUTION, IS A
SECURITY RISK.
For UNIX to UNIX you should investigate the remsh option.
Also investigate the use of a .netrc file.
From the AS400, if you are running a BSI or CSI ftp product, you will find RECEXC available, in which case no entry in the /etc/ftpd/ftp-exec directory is necessary.

Best of luck and "be careful out there".

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Singaram
Advisor

Re: How to start job after ftp

Thanks Dave

But both dont work for me.
I dont see /etc/ftpd direcotry and site exec command not understood.
Also RECEXE command is not available in AS/400.

So the only way is remsh ??..

Thanks again
Singaram
Dave La Mar
Honored Contributor

Re: How to start job after ftp

The steps I noted were for an HP-UX 11.0 system.
And you have no /etc/ftpd/ftp-exec directory?
You may have to make the ftp-exec directory.
Hang in there, we will get it.
What ftp tool are you using on the AS400?
-dl
"I'm not dumb. I just have a command of thoroughly useless information."
hein coulier
Frequent Advisor

Re: How to start job after ftp

you could add your script in /etc/inet.conf, and make it listen on a specific port, let's say 12345.

Then ftp your data file, and start the script with 'telnet targethost 12345'. In /var/adm/inetd.sec you could secure that only specific hosts are allowed to do the telnet on port 12345.
Muthukumar_5
Honored Contributor

Re: How to start job after ftp

One simple way as,

server1 will send a file to server2. There is a script running on cron to check the file is created on server2 or not. If it is created execute it. That is all.

It will work without any problem or security hole.
Easy to suggest when don't know about the problem!