Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to start the RoR application named fedena.

What I generally do is SSH login as rootand hit these commands

root@cloud:~# cd fedena
root@cloud:~/fedena# script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:7800
and so on...meaning the app server is running

Then when I close the SSH session, the application ends.

Now,what I figured out was for keeping it alive was to run this shell script through webmin interface and it survived. But, I wanted to autorun this script on every boot/restart. I tried to add

./fedena/script/server

before the exit 0 line in the

/etc/rc.local

Alas ! It didn't work. Why I don't understand.

share|improve this question

1 Answer 1

Given your script is bash and the path is /root/fedina/server/script you could have:

##!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

bash /root/fedina/server/script

exit 0

Note: Don't forget about the execution bits (eg. chmod a+x /etc/rc.local)

share|improve this answer
2  
I tried bash /location/of/file but it didn't work. Later I realised my script is ruby script. I then did ruby /location/to/file and it worked. Thanks for the execution bit help @andy.holmes –  VenomVipes Jun 17 '13 at 6:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.