error with upstart script

0

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 ?

Michael

Posted 2014-03-06T02:39:15.050

Reputation: 109

1Is the script being executed using sh? If so, you might expect errors. Execute the script using bash. – devnull – 2014-03-06T02:58:16.263

@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 – 2014-03-06T03:04:09.737

No answers