0

Here's the script:

#!/usr/bin/env ruby

CODES = {}
puts "ok"

Under root user everything is fine:

# ./test.rb
ok

When munin's default interpreter is /bin/false nothing is happpening:

# su munin -c ./test.rb

When default interpreter is /bin/sh, it is always being used:

# su munin -c ./test.rb
./test.rb: line 3: CODES: command not found

Why under munin user Linux ignores the interpreter line from the script, while under root it works as usual?

Update. Finally it just started to work without any intentional fix from me.

1 Answer 1

1

#! is interpreted by shell and if you not specify what shell you need by -s SHELL then it is default shell - /bin/false in you case. And false not understand #! syntax (in fact - not read you script at all). Use -s /bin/sh with su and it will work as you want.

2
  • Munin itself will run the script with default interpreter. When default for its user is /bin/sh it tries to run the Ruby script as his own script. Mar 22, 2013 at 7:03
  • @PavelKoryagin This part I don't understand - only good explanation for me is space between # and ! or on start of line, but it is obviously not a case because it works without su. Anyway - glad to hear it works for you now.
    – dsznajder
    Mar 22, 2013 at 8:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .