3

So I am trying to set up some application background processes to start on boot using systemd. It always gives me 127 exit code and I am not sure why. I thought that ExecStart command is being executed in a wrong directory. So I added ExecStartPre to output the current directory but it was not executed as well.

Here is my service file:

[Unit]
Description=Background processes

[Service]
Type=simple
User=epic
Environment=RAILS_ENV=production
WorkingDirectory=/home/epic/application
ExecStartPre=/bin/pwd > /home/epic/test.sys
ExecStart=/usr/local/rvm/gems/ruby-1.9.3-p194/bin/rake jobs:work

And the messages log shows when I execute systemctl start epic.service:

Apr 24 05:13:01 application systemd[1]: epic.service: main process exited, code=exited, status=127
Apr 24 05:13:01 application systemd[1]: Unit epic.service entered failed state.

How can I know what is going wrong! I tried to execute the command in shell and it works (if it was in the right directory). The server is running on Fedora 15.

1 Answer 1

2

systemd does not support arbitrary shell commands with its Exec* statements, thus the redirection you're trying will not work. You could write a quick script and call that:

/home/epic/pwd.sh:

#!/bin/sh
/bin/pwd > /home/epic/test.sys

ExecStartPre=/home/epic/pwd.sh

Also you may want to read up on rvm wrappers to see if that would be better than calling rake directly from the rvm installation path, http://deepakprasanna.blogspot.com/2011/06/rvm-wrappers.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .