2

i have a ubuntu EC2 instance and i want start my rails server at boot. So i have a script:

start.sh

#!/bin/bash
#
# Start Rails Server
cd ~/spree
rails server -d

and i have this in my rc.local:

rc.local

#!/bin/sh -e
#
# rc.local
#
sudo -u ubuntu -i ~/start.sh

exit 0

if i run "sudo /etc/init.d/rc.local start", all work fine but at reboot the server not start...any suggestion?

2
  • 2
    /bin/sh I think doesn't recognise ~ path. – hjpotter92 Oct 5 '16 at 16:51
  • @hjpotter92 i have changed the ~ with my path, but the problem persist. – SaroVin Oct 6 '16 at 9:42
0

SOLUTION:

#!/bin/bash
#
# Start Rails Server
cd /home/ubuntu/spree && rails server -d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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