I have a simple upstart script that exec my daemon. When doing so, the correct pid is returned by upstart, but my daemon is not able to create the actual pid file.
script
VM=$(cat /proc/meminfo | grep MemTotal | awk '{ print $2 }')
ulimit -v $VM
ulimit -c unlimited
exec $DAEMON
end script
If I execute $DAEMON from the command line, then everything forks and the pid file is created as expected.