Ubuntu – Auto start Rails project upon boot (ubuntu)

ruby-on-railsUbuntu

I've been searching on this for 2 days.
I tried three ways:

1.Add some file in init.d

Ok I have to admit I dun know how to see error log ,
seems promising but doesn't work

2.Try start thin server upon boot

I follow post this to last step, can run service thin start.
then got lost.when I restart my machine the web page is still not on

3.Modify /etc/rc.local

This way seems eazy,I've tried few times.Just not working.
Might because I dun know how to do 'change dir' and run 'rails s &' in correct format.
and also have problem writing my own bash file/link to it in this file.

Say my rails folder is in /home/username/trail/myrailsapp
How can I start it upon machine boot.

Please help me!Really newbie seek help!
thanks in advance

Best Answer

why not just add a cronjob to start rails after rebooting?

crontab -e

Add:

@reboot rails /home/username/trail/myrailsapp/file.ruby &