15

Having a nightmare migrating some upstart jobs from Ubuntu to EC2 Linux (ElasticBeanstalk)

I am unable to get even the most basic task to work. I am using the script below which works perfectly on Ubuntu but returns the very unhelpful "unrecognised service" when I try to start it in EC2 Linux. I have read this is usually a syntax error but that doesnt follow if this is syntactically OK for Ubuntu. Any help massively appreciated, I just need any working example.

This is in /etc/init/test.conf created as root user.

Console:

# sudo service test start
# test: unrecognized service

/etc/init/test.conf:

description "test"

start on startup

script
  echo $(ping -c 1 serverfault.com) > /var/log/testjob.log
end script
Mike Miller
  • 401
  • 1
  • 3
  • 9

3 Answers3

12

So for some reason initctl likes it and service doesnt...

sudo initctl start test
test start/running, process 8776

A bug in EC2 Linux me thinks. My example exactly conforms to the documentation but no biggy to switch to using initctl

If you like to check which services are running you also can do this:

sudo initctl list

And to verify where the log error read the file in /var/log/messages

Bill Weiss
  • 10,782
  • 3
  • 37
  • 65
Mike Miller
  • 401
  • 1
  • 3
  • 9
  • Maybe I should have searched for this answer before spending a day trying to fix it myself, and then trying to install daemontools........ – Asfand Qazi Dec 23 '15 at 12:12
1

If you are using the AWS Linux AMI instead of the Ubuntu one use:

start on started network
Optichip
  • 357
  • 1
  • 7
0

With upstart, the syntax should be sudo start test and sudo stop test, rather than the "service" syntax used by the init.d system.

grant
  • 188
  • 9