Reputation: 61
I have three different scripts that I'd like to run on startup - currently I'm running them via:
nohup ruby script1.rb & disown
I can't seem to find how to run each of these scripts on startup, i.e. if the server happens to reboot.
/usr/bin/ruby
/usr/bin/gem
Distribution: Debian
Upvotes: 3
Views: 1550
Reputation: 22296
You need to add the shebang line to your script:
#!/usr/bin/env ruby
and them make you script executable
chmod +x great_script.rb
and then use it with full path, like this
/home/user/bin/great_script.rb
Also you could add your scripts folders to path:
export PATH=/home/user/bin:$PATH
Since you don't mention your distribuition, you need to check how can you add a script to the startup system manager, although following what I've posted you are able to run Ruby scripts like any regular bash script.
UPDATE
In debian, according to the documentation
/etc/init.d/
update-rc.d great_script.rb defaults
Upvotes: 3