ruby-on-railsrubyscriptingcronshebang

have a relative shebang line


I'm writing a rails app and need to run come scripts through ./script/runner

while i could put

#!/home/cannon/src/timetracker/script/runner 

at the top, that wont work in production where it needs to be more like

#!/var/www/loclahost/htdocs/timetracker/script/runner -e=production

since ./script is not in my path, and I don't want it to be, how can I allow this to be set up,

I am using a cron job to run it on a Linux box


Solution

  • Use env in the shebang line to look things up in the path:

    #!/usr/bin/env ./script/runner