-3

I'm very new to Ec2. And I wrote a set of shell scripts and run over ec2 instance :

ec2-run-instances ami-82fa58eb -d Setup.sh

I just get the following output :

RESERVATION r-ed405088  980691203742    default
INSTANCE    i-7eb12d06  ami-82fa58eb            pending     0       m1.small    2012-07-13T08:15:25+0000    us-east-1a  aki-825ea7eb        monitoring-disabled                 ebs                 paravirtual xen     sg-ff369697 default

How come I know that my shell script have been successfully executed?

karti
  • 3
  • 1
  • Shouldn't you know it's been successfully executed because whatever you wanted to the shell script to do has been done? – womble Jul 13 '12 at 09:19
  • @womble: Thats what the problem is. In my script I did installing `auditd` package. And logged all the info into `/tmp/install.log`. Now how can I know that it got install? How can I open the `/tmp/install.log` file? – karti Jul 13 '12 at 09:25
  • You could look to see if the `auditd` package is installed. – womble Jul 13 '12 at 09:34
  • Sorry again, I'm new to ec2. How come I see that? Thats my question. – karti Jul 13 '12 at 09:39
  • That's not an EC2 thing, that's a "Sysadmin 101" thing. Reading the docs for your package manager (whatever that may be) would probably be a good first step. – womble Jul 13 '12 at 09:40
  • I guess I'm missing some concepts here. I have created a Ubuntu instance in ec2. And installed `auditd` in ec2 from my shell. Now I guess the `auditd` package has been installed in my ec2 instance (provided that my shell script runs successfully). Now my question is, how to check in ec2 that `audidt` has been installed? Or else I'm missing some concepts here.. – karti Jul 13 '12 at 09:44
  • Yeah, you're missing some concepts. Like the fact the EC2 has nothing to do with your package manager. It's just an Ubuntu VM, with a slightly hinky boot sequence. Treat it like any other. – womble Jul 13 '12 at 09:47
  • @womble: So its like, since I configured the log to be in `/tmp/install.log` file, I need to check in my system? Since I can't see in ec2 since its an VM. Am I correct now?? – karti Jul 13 '12 at 10:04
  • What does the log have to do with anything? – womble Jul 13 '12 at 10:21
  • @womble: No all the standard outputs are redirected to `/tmp/install.log` file, while installing `auditd` package. So as I mentioned before I need to check in my systems `/tmp/install.log` ? – karti Jul 13 '12 at 10:28
  • No, you don't need to check in your logs, you need to ask your package manager if the install completed. – womble Jul 13 '12 at 10:31
  • @womble: This is my shell script : sudo apt-get install auditd. Now to whom I need to ask for whether the installation is completed? – karti Jul 13 '12 at 10:38
  • @karti: Just log in to your virtual machine using `ssh` and the authentication key which you have generated on the web interface. I think you have not realized that using ssh is the normal way to access the virtual machine, instead of giving *user data* arguments to `ec2-run-instances`. This is really UNIX/Linux basics and is not any different in EC2. – snap Jul 13 '12 at 10:49
  • @snap: So I'm very new to Ubuntu and also to ec2. SO will use ssl to connect to my VM and then run the scripts.. Thanks – karti Jul 13 '12 at 11:29
  • @karti: Read again: SSH, not SSL. – snap Jul 13 '12 at 13:47

1 Answers1

0

You can make the shell script create a log file, log into syslog with logger command, send an e-mail to yourself, use Amazon SNS or notify you in some other way.

I think the output of user data shell scripts is not stored anywhere.

I found this blog post useful for learning how to utilize user data for customizing a new instance when setting it up.

snap
  • 1,251
  • 10
  • 18
  • I have logged all the things into `/tmp/install.log` file. Is there any way to see that file in ec2 instance? – karti Jul 13 '12 at 09:10