[15:31] <mattzuba> Hoping someone can help real quick... I'm trying to write an upstart job to start up a daemon, but the daemon requires to be run under a different user.  I'm running on AWS EC2 with upstart 0.6.5, so I can't use setuid/setgid, and sudo/su isn't working (Terminated with status 1).  I can paste my script if needed
[15:33] <jodh> mattzuba: just read http://upstart.ubuntu.com/cookbook/#run-a-job-as-a-different-user
[15:34] <mattzuba> I've used a few of those suggestions, but they haven't worked.  I have to source a script prior to running the daemon to setup some environment variables, so I'm using a script stanza.  I've used various versions of those exec calls and they all fail to stay running.  I can't use start-stop-daemon since it's not available either.
[15:35] <mattzuba> script
[15:35] <mattzuba>     . /opt/elasticbeanstalk/support/envvars
[15:35] <mattzuba>     sudo -Eu webapp /var/app/current/artisan queue:work --daemon --tries=3 --sleep=5
[15:35] <mattzuba> end script
[15:35] <mattzuba> the sudo line works fine when I run it on the command line, but not via upstart
[15:35] <mattzuba> i tried putting exec in front of sudo as well with the same results
[15:45] <jodh> mattzuba: in which case, you'll want to look at http://upstart.ubuntu.com/cookbook/#see-the-environment-a-job-runs-in and http://upstart.ubuntu.com/cookbook/#checking-how-a-service-might-react-when-run-as-a-job. Also, presumably you're using 'sudo -E'?
[15:45] <jodh> mattzuba: ah - sorry, yes you are :)
[15:46] <mattzuba> thanks, I'll take a read over those. The cookbook has lots of great info, just wish it was easier for a Upstart newb like me to parse through, heh
[15:47] <jodh> mattzuba: try using my procenv tool as you can diff the output. It's covered in the links above. Changes are the problem is that when upstart runs your job, key env vars are not set. Note: http://upstart.ubuntu.com/cookbook/#job-environment
[15:48] <mattzuba> cool.  the only envvars I need are custom ones set in the elastic beanstalk support envvars file, nothing special to the system that I can think of anyway
[16:00] <mattzuba> got it!!!
[16:02] <mattzuba> this seemed to work, the only one I hadn't tried yet: exec su -s /bin/sh -c 'exec "$0" "$@"' webapp -- /var/app/current/artisan queue:work --daemon