I have an upstart script that does the following

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


pre-start script
    exec >/dev/kmsg 2>&1
    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 >/dev/kmsg 2>&1
    echo "stopped"
end 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 ?


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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.