-
Notifications
You must be signed in to change notification settings - Fork 186
Example Init Scripts
Mike Quinlan edited this page May 16, 2017
·
4 revisions
If you want to start your release automatically at boot time, you need to add an init script
- Upstart (Ubuntu)
deploy@host:~$ cat /etc/init/example_phoenix.conf
description "example_phoenix"
setuid deploy
setgid deploy
start on runlevel [2345]
stop on runlevel [016]
expect stop
respawn
env HOME=/home/deploy/example_phoenix
export HOME
pre-start exec /bin/sh /home/deploy/example_phoenix/bin/example_phoenix start
post-stop exec /bin/sh /home/deploy/example_phoenix/bin/example_phoenix stop
- Systemd (Ubuntu)
[Unit]
Description=example_phoenix
After=network.target
[Service]
User=deploy
Group=deploy
Restart=on-failure
Type=forking
Environment=HOME=/home/deploy/example_phoenix
EnvironmentFile=/home/deploy/example_phoenix.env # For environment variables like REPLACE_OS_VARS=true
ExecStart= /home/deploy/example_phoenix/bin/example_phoenix start
ExecStop= /home/deploy/example_phoenix/bin/example_phoenix stop
[Install]
WantedBy=multi-user.target