Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
google site



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-28-2009
Registered User
 

Join Date: Jul 2006
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
scp automation

my source folder is :/tmp/util
of server : pyxis-as2

and target folder is :/apps/prodapp/util/
of server : pyxis-db2

i am trying to do a copy from source to target through SCP

is there any way that I can kick shell script from pyxis-as2 once any single file get loaded into /tmp/util

my scp script is :

Code:
scp -r /tmp/util/*.csv user@pyxis-db2:/apps/prodappl/util/

plus how should i bypass the password into script

any help will be highly appreciated
Sponsored Links
  #2  
Old 12-28-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
 

Join Date: Dec 2008
Location: Sqrt[-e^(-2 i Pi)]
Posts: 3,789
Thanks: 1
Thanked 63 Times in 60 Posts
Do you need to copy them the instant they appear, or is a certain interval OK? For the later, run your command via cron every n minutes. For the former you'll need a script that always runs checking the dir, or hook into the process that puts the file there (eg by watching the FTP transfer log)

As for the authentication bit: don't pass the password along, use public-key authentication instead.
  #3  
Old 12-29-2009
Registered User
 

Join Date: Jul 2006
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
scp automation

thanks pludi,sorry to little troubling you.

Thanks for advicing for using public-key authentication, I am able to test the public-key authentication.This part i am able to handle. There was step by step process for adding public-key authentication. I am able to do,

I want to do a file transfer as soon as any file get entered into a particular folder.

I am not sure about unix cron program , as I am not a fully unix guys.

My requirement is very simple like a trigger in oracle.

The reason I am looking, as Unix side, application server is located in different box and database in different box. I have built a page (web page) which take the file from user desktop and upload in server in a particular folder. This folder is always fix. Now I have a loader program which requires datafile somewhere in server where DB is there. I could not able to do , and just cheked with DBA they told through scp i can copy, a scp copy scrtipt is working fine , but that requires manual kick-off. This is where I am looking automation, the event should be as soon any file get entered into this folder. If you mention 1 min is requires in cron then I believe it must have options for 1 sec too. But I am not sure , dose Unix handle file transfer or do they have locking.


any input and any thread /insight for cron is highly apprecaited.
  #4  
Old 12-29-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
 

Join Date: Dec 2008
Location: Sqrt[-e^(-2 i Pi)]
Posts: 3,789
Thanks: 1
Thanked 63 Times in 60 Posts
It's not quite that simple. A trigger in a RDBMS is executed as soon as it registers a certain event (row update/insert/..., ...). What the RDBMS is for a database is the filesystem for a file, but I know of no system where it can trigger an executable. So you'll have to find a different approach.

One option might be cron. The limitation with cron is that it's resolution is one minute max, meaning your file would be copied with a maximum delay of 1 minute. If that's enough for you, fine, if not we'll have to find something different.

Another option might be to create a small daemon (like sendmail or cron) that watches a certain directory and copies any file that hasn't changed it's size during the last 2 seconds.

Or, third option, you have some kind of log file what registers when a file starts uploading, and when the upload finished. As soon as it's done start the copy process. Basically a variation of the above.

Finally, if your web page can register an finished upload, use it to start the upload via system() or something similar.
  #5  
Old 12-29-2009
thegeek thegeek is offline Forum Advisor  
Registered User
 

Join Date: Apr 2009
Location: /usr/bin/vim
Posts: 870
Thanks: 2
Thanked 10 Times in 8 Posts
As said, do a daemon or cron to watch and update.

Some more suggestions ( not solution ):
1. set up passwordless login,
2. use -B option ensure endless wait does not happens
3. check whether rsync fits for you.
4. follow the ideas by pludi, and implement a system, and get back to us.
  #6  
Old 12-30-2009
Registered User
 

Join Date: Sep 2009
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
if you need for connecting from one server to another server without password, you can use RSA alghorithm.
it use public key and private key. it is secure also.
Good luck.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help in automation... nua7 Shell Programming and Scripting 1 10-03-2008 06:52 AM
S-174: Vulnerability in OLE Automation Linux Bot Security Advisories (RSS) 0 02-12-2008 06:30 PM
Web automation using perl gurukottur Shell Programming and Scripting 1 10-11-2007 12:22 AM
FTP automation Job scheduling SATYAPRIYA_D UNIX for Advanced & Expert Users 1 04-27-2007 10:13 AM
X11 automation? dlundh OS X (Apple) 1 04-18-2007 08:20 AM



All times are GMT -4. The time now is 07:39 AM.