• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Progress on script: Need help with file transfer from online resource to amazon ec2 instance

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am currently writing a unix script for my ec2 instance and I am trying to figure how to make a file transfer from my repository online into the ec2 instance.

What i have so far (or know) is to try:

scp -i http://is/this/the/right/way/to/do/it? ec2@....blah.blah

does this sound right?

Essentially, I want to download those files from my maven repo and upload them to my ec2 machine and then if there are any updates, i have jboss in the script as well to make it update the ec2 instance.

ANY HELP IS APPRECIATED! THANK YOU IN ADVANCED!!
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I normally just type in a password or use a set of stored credentials, so I've never used the "-i" option, but the man page says "file", not "url", so I doubt that will work.

My usage is as follows:



So, if I'm using the same userID on both systems and copying to my remote home directory, this degenerates to:


For an absolute location:
 
James Akins
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Heres an update Tom and thanks for replying. Maybe you can help me with this problem now. Any help is appreciated, thank you!

So I am testing out my UNIX script that I wrote for an instance so it can already have the pre-configured packages and httpd service start. When I input the data in the desired field
"User Data:", it doesn't work. I've tried inputting my Unix code as either a text or a file and neither has worked for me.

This is essentially the script I am writing for the instance(below) and will be more complicated as I incorporate downloading war files from Maven and Jboss.

Admins/top users: Do you see the problem here? When I run these commands manually in Mindterm, it executes perfectly, but when I put it in the "User Data" field it doesn't execute anything. Please help me resolve this. Thanks in advance! Also, this is for the Amazon Linux AMI 2013.03.1 64-bit

Script:

sudo yum update

sudo su

sudo yum -y install httpd mysql mysql-server tomcat* java* apache* git

sudo chkconfig httpd on
/etc/init.d/httpd start

wget http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-web-7.0.2.Final.tar.gz
tar xvfz jboss-as-web-7.0.2.Final.tar.gz
wget http://www.poolsaboveground.com/apache/maven/maven-2/2.2.1/binaries/apache-maven-2.2.1-bin.tar.gz
tar xvfz apache-maven-2.2.1-bin.tar.gz

sudo yum -y update

echo "script is finished"
echo
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure I really understood that, but I'll pretty much guarantee that you can't run an init script (/etc/init.d/http start) properly unless you're privileged (sudo).

Speaking of sudo, you can do "sudo -s" and it will switch you to persistent sudo state until you exit it so you can do stuff like this:



For more info, "man sudo".
 
James Akins
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree those commands word(mine do too), but maybe you may have missed my question.

The script or basic layout that I have provided in my previous post all work perfectly when running manually. I did change my sudo su to sudo -s to see if it made any changes. But my main issue and question is: why isnt my script executing when I input it in the user data field when launching my instance for amazon web services. I am not sure if you are familiar with that or not, but I hope you can help me figure this out.

Thanks in advance, Tim.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic