2

I have an upstart script that does the following

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

respawn

pre-start script
    exec >/dev/kmsg 2>&1
    REPO=git@github.com:blabla/bli
    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 >/dev/kmsg 2>&1
    echo "stopped"
end script

script
    exec >/dev/kmsg 2>&1
    export NODE_ENV=production
    export port=80
    echo "Starting app.js on port 80"
    cd /var/www
    node app.js
end script

I am running the script as root. The log files of the application suppose to go to /var/log/syslog and to rsyslog but they don't go there.

I am using rsyslog to send logs to a remote server

I see the app log when running dmesg | tail -f

Using kernel 3.5.0-46

This script is working on another machine with an older kernel

Anyone know why it doesn't work here ?

Michael
  • 263
  • 2
  • 4
  • 9

1 Answers1

0

You probably want to look at this: http://www.rsyslog.com/doc/droppriv.html Even though rsyslog starts as root, it's quite possible it changes it's user inside /etc/rsyslog.conf. You may want to change rsyslog's privileges inside your rsyslog configuration.

john
  • 101
  • 1