TIL: Marking Application to Start on Startup
Today I discovered that there’s a difference between
systemctl start and
systemctl enable, and that one is required to have your app start on startup.
As part of my initial deployment months and months ago, I went throught he process of registering my applications as services so that I could run start, stop, restart, etc commands on them. During that process, I had set the applications to restart when stopped, and I had assumed that that would be enough to tell them to start on reboot.
There’s actually one other step that needs to take place that I wasn’t aware of. In order to tell the system that an application needs to be included at start up, you need to register it with
systemctl enable. Using that command will tell the system that that service needs to be run every time on start up.
In my case, none of my services (including nginx) were set to start on reboot, which means I would have had to manually go through and restart everything. But by simply running
systemctl enable <service> before rebooting allowed all of my services to return after the reboot was complete.