- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- how to upload using cron
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2007 05:25 PM
04-05-2007 05:25 PM
how to upload using cron
SSH server IP: 10.2.2.10
Ftp server IP: 10.2.2.11
1,
I have to copy a file(/tmp/test.tar.gz) to the ssh server, using userid as "backadmin" and password "123" via schedule(cron). "backadmin", is the user on ssh server.
Now prblm is that I dont know how can i provide the userid/passwd in the crontab file.
So plz write me the syntax to achieve the above using cron.
05 22 * * * /usr/bin/scp /tmp/test.tar.gz 10.2.2.10:/tmp
Obvously fail.. because ssh server ask for userid/passwd
2,
I have to upload a file(/tmp/test.tar.gz) to the ftp server, using userid as "backadmin" and password "123" via schedule(cron). "backadmin", is the user on ftp server.
Now prblm is that I dont know how to ftp, and provide userid/passwd, and then upload a file, using cron.
plz help
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2007 07:29 PM
04-05-2007 07:29 PM
Re: how to upload using cron
You can't directly upload because as you point out you need a username ans password.
But if instead of the command line present you have an upload script with user name and password:
sftp ap1030@sihp8024 <<-EOF
put test_file
bye
EOF
Modify it to your hearts content.
My script above, scraped from itrc fixes the problem identified. Change ap1030 to the backadmin user, blah blah blah.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2007 07:52 PM
04-05-2007 07:52 PM
Re: how to upload using cron
This scrip may work better.
Both servers need openssh to make this work.
sftp backadmin@10.2.2.10 <<-EOF 2>/dev/null
open username passwd
cd /tmp
put /tmp/test.tar.gz
bye
EOF
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2007 08:14 PM
04-05-2007 08:14 PM
Re: how to upload using cron
You mean that i create a script having code you provide ... and then execute the script using cron.. isint ?
Now prblm is that my Ftp server is MS IIS server, and I cant install the ssh on MS IIS server machine.
Second ... the ssh server is running redhat ES 4 but this machine doesnt have vsftpd rpm installed.. and neither I am allowed to install the rpm... so plz provide me the script which just ssh... not the ftp.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2007 10:35 PM
04-05-2007 10:35 PM
Re: how to upload using cron
Second ... the ssh server is running redhat ES 4 but this machine doesnt have vsftpd rpm installed.. and neither I am allowed to install the rpm... so plz provide me the script which just ssh... not the ftp
Ok SEP, as per your instruction, I create a script, and put the following code in it
#!/bin/bash
sftp backadmin@10.2.2.10 <<-EOF 2>/dev/null
<123> ###password of user "backadmin"
cd /home/backadmin
put /tmp/test.tar.gz
bye
EOF
Now when I execute the script it succesfuly upload the test.tar.gz into the /home/backadmin ... but it ask for "password".. i.e i cant use/run this script using cron
Plz help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2007 12:33 AM
04-06-2007 12:33 AM
Re: how to upload using cron
man netrc
This is a way to pass user/pass etc to (ftp,sftp..etc).
You could create a user that is only used for this purpose.
Enjoy life
Jean-Pierre Huc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2007 05:48 PM
04-09-2007 05:48 PM
Re: how to upload using cron
SEP, I think when the Destination server is sshd, then the best I found is "scp", with "host base authentication" to upload the file, using script, and execute the script using cron.
Dear HUC, I will try to follow your instruction
Thanks Once again
Regards
Needee