0

(Can|how do) I use $HOSTNAME in an Ubuntu upstart script like this:

start on started foo
stop on stopped foo

exec someexecutable -n "$HOSTNAME""_bb"
RickyA
  • 300
  • 1
  • 4
  • 12

1 Answers1

1

Yes, since "/etc/network/if-*.d/upstart" scripts are shell scripts, you can use an environment variable such as $HOSTNAME.

Here is what I recommend: set it first with the value you want to be sure of what is inside, like this:

HOSTNAME=`hostname -s`

exec someexecutable -n "$HOSTNAME""_bb"
PixEye
  • 30
  • 5
  • Thanks. That worked. You however have to wrap it in a `script/ end script block` to have upstart execute it. – RickyA Apr 02 '13 at 15:50