Create a new service in Amazon Linux

Viewed 1993

I have an Amazon ec2 instance running Amazon Linux AMI 2018.03. I would like to create a startup service but I can't use systemctl as I'm not on Amazon Linux 2.

The service is a Python script that I would like to run at startup and be able to start/stop. How would I do this?

1 Answers

Amazon Linux 1 is using sysvinit system, unlike systemd in Amazon Linux 2. One way of setting it up to manage your service is shown here.

However, Amazon Linux 1 has only few months left of its lifetime:

Thus if you can, please consider using Amazon Linux 2. Sooner or later you will have to switch to AL2 anyway for security reasons, so may try doing this now.

Related