0

If I run this command from terminal, it works fine:

bundle exec /home/ubuntu/.rbenv/shims/puma -C /var/www/html/mysite/config/puma.rb

But if I was to put that in ExecStart in a systemd service unit file:

[Unit]
Description=Puma Application HTTP Server
After=network.target

[Service]
Type=simple
WorkingDirectory=/var/www/html/mysite

ExecStart=bundle exec /home/ubuntu/.rbenv/shims/puma -C /var/www/html/mysite/config/puma.rb


Restart=always

[Install]
WantedBy=multi-user.target

I will get error:

Executable path is not absolute: bundle exec /home/ubuntu/.rbenv/sh

I think it's complaining that the command must begin with absolute path instead of 'bundle exec'. So I try this:

ExecStart=/bin/bash -lc 'bundle exec /home/ubuntu/.rbenv/shims/puma -C /var/www/html/mysite/config/puma.rb'

Now when I run systemctl daemon-reload and systemctl start puma-mysite, I get this error:

Jan 03 00:07:53 ip-10-0-1-133 systemd[1]: puma-mysite.service: Start request repeated too quickly.

Jan 03 00:07:53 ip-10-0-1-133 systemd[1]: puma-mysite.service: Failed with result 'exit-code'.

Jan 03 00:07:53 ip-10-0-1-133 systemd[1]: Failed to start Puma Application HTTP Server.

It seems to be an issue with SystemD, for the command works outside of SystemD.

0

I got it working by giving bundle command an absolute path too:

ExecStart=/home/ubuntu/.rbenv/shims/bundle exec /home/ubuntu/.rbenv/shims/puma -C /var/www/html/mysite/config/puma.rb

| improve this answer | |
  • Makes sense. “bundle” wasn’t in root’s $PATH so systemd couldn’t exec it, so the bash shell just exited. – jsbillings Jan 3 at 3:21

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.