I created reset_db.sh (with chmod +x
) with the following content:
#!/bin/bash
echo "*** Deleting the database ***"
rake db:drop --trace
echo "*** Creating the database ***"
rake db:create --trace
echo "*** Migrating the database ***"
rake db:migrate --trace
echo "*** Seeding the database ***"
rake db:seed --trace
echo "*** Done! ***"
However, when I run:
bash reset_db.sh
I see:
*** Deleting the database ***
*** Creating the database ***
*** Migrating the database ***
*开发者_C百科** Seeding the database ***
*** Done! ***
but the rake
commands were not executed.
Any ideas why ?
Bonus question:
What should I do in order to be able to run reset_db.sh
rather than bash reset_db.sh
?
Add set -x
at the top of your bash script for more verbose output.
#!/bin/bash
set -x
echo "*** Deleting the database ***"
rake db:drop --trace
echo "*** Creating the database ***"
rake db:create --trace
echo "*** Migrating the database ***"
rake db:migrate --trace
echo "*** Seeding the database ***"
rake db:seed --trace
echo "*** Done! ***"
Does that give you any further information?
to run the command you need to type:
./reset_db.sh
Regarding the rake command, are you in the folder where the rake should be launched?
精彩评论