Running commands/scripts on your server at bootup

Posted on 22 Aug 2016 AWSDevops

Occasionally you want to run a script after your server boots up or restarts.  Perhaps you don’t have enough time to create a service to start or Systemctl to manage your Systemd services.  Maybe your coffee machine is broken and you are 99% there and want to see your efforts come to light.  In this case for load testing I needed to start some docker containers via docker-compose. /etc/rc.local is a convenient place to run scripts on bootup after all services have started.

vi /etc/rc.local
# Boot docker-compose containers
/usr/local/bin/docker-compose --file /home/ec2-user/m2-community/docker-compose.yml up -d

Leave a Reply

Your email address will not be published.

*