brojsimpson
brojsimpson

Reputation: 135

How do I run a rails command command from a shell script?

Say I wanted to run 'User.all.each{|u| u.destroy}' from a shell script called killallusers.sh. How can I call Rails console commands from the shell or from an executable script?

Upvotes: 4

Views: 4408

Answers (1)

the Tin Man
the Tin Man

Reputation: 160631

Either write it as a Rake task, or use Rails "runner".

Inside your shell script put the appropriate rake or runner command.

Upvotes: 11

Related Questions