Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have the following upstart configuration

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

respawn

pre-start script
    exec 2>&1 > >(logger -t "nodejs")
    REPO=git@github.com
    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
    fi
end script

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

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 ?

share|improve this question
1  
Is the script being executed using sh? If so, you might expect errors. Execute the script using bash. –  devnull Mar 6 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 at 3:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.