Further to my last question, I'm now using logger.

I have the following upstart configuration

start on runlevel [2345]
stop on runlevel [06]


pre-start script
    exec 2>&1 > >(logger -t "nodejs")
    mkdir -p /var/log
    mkdir -p /var/www
    echo "Fetching app from $REPO"
    girror $REPO /var/www
    if [ -f /var/www/package.json ]; then
        echo "Installing npm modules"
        cd /var/www
        npm install
end script

post-stop script
    exec 2>&1 > >(logger -t "nodejs")
    echo "stopped"
end script

    exec 2>&1 > >(logger -t "nodejs")
    export NODE_ENV=production
    export port=80
    echo "Starting app.js on port 80"
    cd /var/www
    node app.js
end script

I am getting the error

/proc/self/fd/9: 2: /proc/self/fd/9: Syntax error: redirection unexpected

I suspect it's the line

exec 2>&1 > >(logger -t "nodejs")

Although it was working when I ran it in a normal shell script.

You know whats wrong ?

  • 1
    Is the script being executed using sh? If so, you might expect errors. Execute the script using bash. – devnull Mar 6 '14 at 2:58
  • @devnull I'm not sure how upstart is executing it's scripts. Can I force it to use bash in any way ? I see that /bin/sh is actuallt pointing to dash – Michael Mar 6 '14 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.