In the Amazon Linux 2 release notes, Amazon advises that initscripts should no longer exist in /etc/init.d

Amazon Linux 2 uses the systemd 219 init system to bootstrap userspace and manage system processes. It is available as /sbin/init and replaces the System V-style init system that was available in the previous generation of Amazon Linux. As a result, initscripts should no longer exist in /etc/init.d. systemctl {start|stop|restart} SERVICE_NAME.service should be used in its place. Additionally, service SERVICE_NAME {start|stop|restart} is compatible with both Amazon Linux AMI and Amazon Linux 2.

We rely on an initscript to auto-start Supervisor when the instance boots. Is there a viable alternative under the systemd 219 init system?

  • Have a look at EC2 user-data. – Tim Jul 8 '19 at 21:41
  • systemd entirely replaces supervisor. – Michael Hampton Jul 9 '19 at 0:14

The new way is to create systemd unit file for your application or startup script. It may seem like an overkill for simple startup scripts but it is the way that most current Linux distros adopted - Amazon Linux, Redhat, Ubuntu, Debian, they all use systemd so it pays to know how to do it properly.

Have a look here for example: Creating and modifying systemd unit files

Hope that helps :)

  • As systemd is over eight years old now, most software you might run as a service already includes sample systemd units, or such units are available on the Internet. – Michael Hampton Jul 9 '19 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.