Ask Your Question
0

Own service - 'command not found...'

asked 2013-05-22 05:42:12 -0500

lciura gravatar image

updated 2013-06-04 22:59:02 -0500

Hi,

I have problem with created service.

My scripts:

File: /usr/lib/systemd/system/own.service

[Unit] 
Description=service web 
After=syslog.target

[Service] 
Type=forking 
ExecStart=/bin/sh /home/lciura/Projects/website/service_helper

[Install] 
WantedBy=multi-user.target

File: /home/lciura/Projects/website/service_helper

#!/bin/bash
# service_helper - for starting ukpower page

PATH+=":/usr/local/rvm/gems/ruby-1.9.3-p327/bin:/usr/local/rvm/gems/ruby-1.9.3-p327@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p327/bin:/usr/local/rvm/bin"

cd /home/lciura/Projects/website passenger start > /home/lciura/Projects/website/log/passenger/log_test 2>&1 & 
exit $?

I use this command to start service:

[lciura@localhost system]$ sudo systemctl start ukpower.service

Service status give me:

Loaded: loaded (/usr/lib/systemd/system/own.service; disabled)
          Active: inactive (dead)

And log file has:

/home/lciura/Projects/website/service_helper: line 9: passenger: command not found

Any idea why this isn't work? I use Fedora 18.

Thanks for your time! :)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-05-23 17:19:22 -0500

updated 2013-05-23 17:20:12 -0500

cd /home/lciura/Projects/website passenger start

You either need to change directories and execute the application as seperate commands:

cd /home/lciura/Projects/website; ./passenger start

Or simply call the executable directly:

/home/lciura/Projects/website/passenger start

Note that you could probably just do this in the .service file without the intermediary bash script.

edit flag offensive delete link more
0

answered 2013-05-23 14:43:17 -0500

sergiomb gravatar image

cd /home/lciura/Projects/website passenger start > /home/lciura/Projects/website/log/passenger/log_test 2>&1 &

try: cd /home/lciura/Projects/website ./passenger start > /home/lciura/Projects/website/log/passenger/log_test 2>&1 &

edit flag offensive delete link more

Comments

No. You're still passing two different commands on one line.

randomuser gravatar imagerandomuser ( 2013-07-02 22:54:12 -0500 )edit

Question Tools

Stats

Asked: 2013-05-22 05:42:12 -0500

Seen: 356 times

Last updated: Jun 04 '13