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

3 Answers 3

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

1
  • Maybe I should have searched for this answer before spending a day trying to fix it myself, and then trying to install daemontools........ Dec 23, 2015 at 12:12
1

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

start on started network
6
  • Appreciate the suggestion but no joy. Still giving me the "unrecognised service" error Dec 30, 2014 at 12:54
  • what AMI are you using?
    – Optichip
    Dec 30, 2014 at 13:01
  • Latest EC2 Linux - whatever Amazon spin up with ElasticBeanstalk applications. Thanks for your help, found an answer posted below Dec 30, 2014 at 13:42
  • Great, I'll keep that one in mind as well.
    – Optichip
    Dec 30, 2014 at 13:54
  • Further to your suggestion I think the elasticbeanstalk equivalent would be start on started elastic-network-interfaces Jan 2, 2015 at 10:34
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.

1
  • Amazon Linux uses an old version of Upstart, which does not recognise jobs in /etc/init Dec 23, 2015 at 12:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .