Problem creating a service on Debian

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a Sinatra application at /my/app/folder/app.rb which I normally execute on my local machine with the command rackup -p 9210. I would like to create a service that starts the app at every boot and restart. I have tried the following but it did not work:



$ vim /lib/systemd/system/mydaemon.service

[Unit]
Description=Simple supervisor

[Service]
User=username
Group=username
WorkingDirectory=/my/app/folder/
Restart=always
ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210


Then I reload the deamons:
systemctl- deamon-reload, start the service: systemctl start mydaemon and check status and I get this error:



● mydeamon.service - Simple deamon
Loaded: loaded (/lib/systemd/system/mydeamon.service; static)
Active: failed (Result: start-limit) since Wed 2017-12-06 17:07:39 GMT; 5s ago
Process: 355 ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210 (code=exited, status=127)
Main PID: 355 (code=exited, status=127)

mydeamon.service: main process exited, code=exited, status=127/n/a
Unit mydeamon.service entered failed state.
mydeamon.service holdoff time over, scheduling restart.
Stopping Simple deamon...
Starting Simple deamon...
mydeamon.service start request repeated too quickly, refusing to start.
Failed to start Simple deamon.
Unit mydeamon.service entered failed state.


What am I missing here?



I use RVM so I have also tried:



ExecStart=/usr/local/rvm/wrappers/ruby-2.3.0/rackup -p 9210



but it didn't work either.
I would appreciate any suggestions.







share|improve this question






















  • I think status 127 is "not executable", due to can't find the path or not allowed to execute it. Did you try running the command specified in ExecStart manually?
    – mjb2kmn
    Dec 8 '17 at 23:09










  • Also a side note: you should add services to /etc/systemd/system/, not /lib/systemd/system/.
    – mjb2kmn
    Dec 8 '17 at 23:11










  • And you're missing a "WantedBy", although to be honest I'm not 100% certain it's required. Docs here: freedesktop.org/software/systemd/man/systemd.service.html
    – mjb2kmn
    Dec 8 '17 at 23:19














up vote
0
down vote

favorite












I have a Sinatra application at /my/app/folder/app.rb which I normally execute on my local machine with the command rackup -p 9210. I would like to create a service that starts the app at every boot and restart. I have tried the following but it did not work:



$ vim /lib/systemd/system/mydaemon.service

[Unit]
Description=Simple supervisor

[Service]
User=username
Group=username
WorkingDirectory=/my/app/folder/
Restart=always
ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210


Then I reload the deamons:
systemctl- deamon-reload, start the service: systemctl start mydaemon and check status and I get this error:



● mydeamon.service - Simple deamon
Loaded: loaded (/lib/systemd/system/mydeamon.service; static)
Active: failed (Result: start-limit) since Wed 2017-12-06 17:07:39 GMT; 5s ago
Process: 355 ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210 (code=exited, status=127)
Main PID: 355 (code=exited, status=127)

mydeamon.service: main process exited, code=exited, status=127/n/a
Unit mydeamon.service entered failed state.
mydeamon.service holdoff time over, scheduling restart.
Stopping Simple deamon...
Starting Simple deamon...
mydeamon.service start request repeated too quickly, refusing to start.
Failed to start Simple deamon.
Unit mydeamon.service entered failed state.


What am I missing here?



I use RVM so I have also tried:



ExecStart=/usr/local/rvm/wrappers/ruby-2.3.0/rackup -p 9210



but it didn't work either.
I would appreciate any suggestions.







share|improve this question






















  • I think status 127 is "not executable", due to can't find the path or not allowed to execute it. Did you try running the command specified in ExecStart manually?
    – mjb2kmn
    Dec 8 '17 at 23:09










  • Also a side note: you should add services to /etc/systemd/system/, not /lib/systemd/system/.
    – mjb2kmn
    Dec 8 '17 at 23:11










  • And you're missing a "WantedBy", although to be honest I'm not 100% certain it's required. Docs here: freedesktop.org/software/systemd/man/systemd.service.html
    – mjb2kmn
    Dec 8 '17 at 23:19












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a Sinatra application at /my/app/folder/app.rb which I normally execute on my local machine with the command rackup -p 9210. I would like to create a service that starts the app at every boot and restart. I have tried the following but it did not work:



$ vim /lib/systemd/system/mydaemon.service

[Unit]
Description=Simple supervisor

[Service]
User=username
Group=username
WorkingDirectory=/my/app/folder/
Restart=always
ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210


Then I reload the deamons:
systemctl- deamon-reload, start the service: systemctl start mydaemon and check status and I get this error:



● mydeamon.service - Simple deamon
Loaded: loaded (/lib/systemd/system/mydeamon.service; static)
Active: failed (Result: start-limit) since Wed 2017-12-06 17:07:39 GMT; 5s ago
Process: 355 ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210 (code=exited, status=127)
Main PID: 355 (code=exited, status=127)

mydeamon.service: main process exited, code=exited, status=127/n/a
Unit mydeamon.service entered failed state.
mydeamon.service holdoff time over, scheduling restart.
Stopping Simple deamon...
Starting Simple deamon...
mydeamon.service start request repeated too quickly, refusing to start.
Failed to start Simple deamon.
Unit mydeamon.service entered failed state.


What am I missing here?



I use RVM so I have also tried:



ExecStart=/usr/local/rvm/wrappers/ruby-2.3.0/rackup -p 9210



but it didn't work either.
I would appreciate any suggestions.







share|improve this question














I have a Sinatra application at /my/app/folder/app.rb which I normally execute on my local machine with the command rackup -p 9210. I would like to create a service that starts the app at every boot and restart. I have tried the following but it did not work:



$ vim /lib/systemd/system/mydaemon.service

[Unit]
Description=Simple supervisor

[Service]
User=username
Group=username
WorkingDirectory=/my/app/folder/
Restart=always
ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210


Then I reload the deamons:
systemctl- deamon-reload, start the service: systemctl start mydaemon and check status and I get this error:



● mydeamon.service - Simple deamon
Loaded: loaded (/lib/systemd/system/mydeamon.service; static)
Active: failed (Result: start-limit) since Wed 2017-12-06 17:07:39 GMT; 5s ago
Process: 355 ExecStart=/usr/local/rvm/gems/ruby-2.3.0/bin/rackup -p 9210 (code=exited, status=127)
Main PID: 355 (code=exited, status=127)

mydeamon.service: main process exited, code=exited, status=127/n/a
Unit mydeamon.service entered failed state.
mydeamon.service holdoff time over, scheduling restart.
Stopping Simple deamon...
Starting Simple deamon...
mydeamon.service start request repeated too quickly, refusing to start.
Failed to start Simple deamon.
Unit mydeamon.service entered failed state.


What am I missing here?



I use RVM so I have also tried:



ExecStart=/usr/local/rvm/wrappers/ruby-2.3.0/rackup -p 9210



but it didn't work either.
I would appreciate any suggestions.









share|improve this question













share|improve this question




share|improve this question








edited Dec 6 '17 at 17:50









Jeff Schaller

32k848109




32k848109










asked Dec 6 '17 at 17:46









jedi

1186




1186











  • I think status 127 is "not executable", due to can't find the path or not allowed to execute it. Did you try running the command specified in ExecStart manually?
    – mjb2kmn
    Dec 8 '17 at 23:09










  • Also a side note: you should add services to /etc/systemd/system/, not /lib/systemd/system/.
    – mjb2kmn
    Dec 8 '17 at 23:11










  • And you're missing a "WantedBy", although to be honest I'm not 100% certain it's required. Docs here: freedesktop.org/software/systemd/man/systemd.service.html
    – mjb2kmn
    Dec 8 '17 at 23:19
















  • I think status 127 is "not executable", due to can't find the path or not allowed to execute it. Did you try running the command specified in ExecStart manually?
    – mjb2kmn
    Dec 8 '17 at 23:09










  • Also a side note: you should add services to /etc/systemd/system/, not /lib/systemd/system/.
    – mjb2kmn
    Dec 8 '17 at 23:11










  • And you're missing a "WantedBy", although to be honest I'm not 100% certain it's required. Docs here: freedesktop.org/software/systemd/man/systemd.service.html
    – mjb2kmn
    Dec 8 '17 at 23:19















I think status 127 is "not executable", due to can't find the path or not allowed to execute it. Did you try running the command specified in ExecStart manually?
– mjb2kmn
Dec 8 '17 at 23:09




I think status 127 is "not executable", due to can't find the path or not allowed to execute it. Did you try running the command specified in ExecStart manually?
– mjb2kmn
Dec 8 '17 at 23:09












Also a side note: you should add services to /etc/systemd/system/, not /lib/systemd/system/.
– mjb2kmn
Dec 8 '17 at 23:11




Also a side note: you should add services to /etc/systemd/system/, not /lib/systemd/system/.
– mjb2kmn
Dec 8 '17 at 23:11












And you're missing a "WantedBy", although to be honest I'm not 100% certain it's required. Docs here: freedesktop.org/software/systemd/man/systemd.service.html
– mjb2kmn
Dec 8 '17 at 23:19




And you're missing a "WantedBy", although to be honest I'm not 100% certain it's required. Docs here: freedesktop.org/software/systemd/man/systemd.service.html
– mjb2kmn
Dec 8 '17 at 23:19















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409266%2fproblem-creating-a-service-on-debian%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409266%2fproblem-creating-a-service-on-debian%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?