4

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.

1 Answer 1

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)

1
  • 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, 2013 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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