I'm now trying to deploy my Phoenix(Elixir) application in Ubuntu 16.04. For persistency, I'm using this file (app.service) in /lib/systemd/system.
[Unit]
Description=Runner for My Phoenix App
[Service]
WorkingDirectory=/app
Environment=MIX_ENV=prod PORT=4000
ExecStart=/app/bin/app start
ExecStop=/app/bin/app stop
User=mohideen
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
My username is mohideen and the account has sudo rights. When I try to use the command sudo systemctl start app.service, the command fails with the following error:
Failed to start app.service: Unknown unit: app.service
See system logs and 'systemctl status app.service' for details.
When I type sudo systemctl status app.service, I get this message:
Failed to get properties: No such interface ''
The app works fine when I start it manually. Why am I getting this error? How can I ensure that my application gets restarted on reboot and crash?
flaglink at the bottom of your Q and ask the moderator to move it. Please don't post the same Q on 2 different sites. Please read stackoverflow.com/help/how-to-ask stackoverflow.com/help/dont-ask and stackoverflow.com/help/mcve before posting more Qs here. Good luck. – shellter Mar 17 '17 at 15:04/lib/systemd/systemis the correct place to put .service files in your OS? As far as I know, in Ubuntu 16.04, they should be in/etc/systemd/system. Also try runningsystemctl daemon-reloadbefore runningstartorstatus. – Dogbert Mar 17 '17 at 15:10