[03:44] <delfick> hi there. I have an upstart conf that starts up my uwsgi server and it seems that it's causing every message from uwsgi to be duplicated to syslog. If I run the script on the command line (start-stop-daemon executing uwsgi) then they don't duplicate
[03:45] <delfick> does anyone have any ideas on how to debug this issue? or why it would happen at all?
[03:45] <hyperair> check how many syslog processes are running.
[03:47] <hyperair> presumably uwsgi talks to rsyslogd which writes to /var/log/syslog. if every message is being duplicated, that could mean that either more than one rsyslogd process is running, or uwsgi is logging everything twice (multiple uwsgi instances?)
[03:47] <hyperair> what does the output from either case look like anyway?
[03:47] <hyperair> the terminal output from starting uwsgi i mean.
[04:02] <delfick> ok
[04:02] <delfick> so
[04:02] <delfick> there's only one rsyslog process
[04:06] <delfick> and the log looks like this http://pastebin.com/nYsYLjBf
[08:32] <callen> I'm having problems with my upstart job in /etc/init, service/initctl/et al don't seem to see the job. status: Unknown job
[08:32] <callen> https://www.refheap.com/5471cb430dda4d0e426aa86ab this is the script, I don't see any relevant logs in /var/log/upstart either.
[08:32] <callen> is there something I've seriously misunderstood? I'm running service as root, the conf in /etc/init is owned by root:root
[08:33] <xnox> callen: Please try running: init-checkconf /etc/init/YOUR-JOB.conf
[08:33] <xnox> to verify syntax.
[08:34] <xnox> callen: please note upstart job configuration files are not executable scripts. Thus should not have "#!upstart", should be regular files, with ".conf" extension.
[08:35] <callen> xnox: noted, I didn't have that before, it was cargo cult in the midst of my desperation to get it working.
[08:35] <xnox> callen: cargo cult from here http://upstart.ubuntu.com/cookbook/
[08:35] <xnox> =) it's the documentation, guide and examples.
[08:36] <callen> xnox: have been'
[08:36] <callen> I branched out from that when it didn't work.
[08:36] <callen> xnox: it doesn't like my script stanza.
[08:37] <xnox> callen: any hidden/non-printable characters? windows line ending?
[08:38] <callen> ah bloody hell
[08:38] <xnox> callen: copy & pasting from the paste, validates correctly by init-checkconf here on Ubuntu.
[08:39] <callen> xnox: I had a stale file remotely.
[08:39] <callen> xnox: it checks out now, although it seems to be stuck on stop/waiting.
[08:40] <callen> xnox: it's choking on my use of "source"
[08:40] <callen> xnox: what's the proper way to inject an environment?
[08:41] <callen> .?
[08:43] <xnox> callen: both source and '.' are the same.
[08:44] <xnox> callen: you have respawn set. So if you are trying to start it, and daemon exits it gets stuck respawing. I'd try removing respawns & check to see that it starts & stops correctly.
[08:44] <xnox> callen: check logs under /var/log/upstart/YOURJOB
[08:44] <callen> xnox: it's working now.
[08:45] <callen> xnox: the problem was source, using . fixed it.
[08:45] <callen> must be /bin/sh
[08:45] <xnox> hm. ok.
[08:48] <callen> xnox: I'm in good shape now, thank you so much for helping me out.
[08:48] <callen> xnox: the suggestion to use init-checkconf saved my sanity :)
[08:49] <xnox> callen: =) no problem and your welcome.
[08:49] <xnox> callen: guess why it was written in the first place...... =)
[15:55] <codelotus> can someone tell me if the following is possible in upstart:
[15:55] <codelotus> script
[15:55] <codelotus>   # a shell file that launches a java daemon
[15:55] <codelotus> end script
[15:56] <codelotus> I've been through the cookbook with no luck and I'm starting to wonder if I'm thinking about this the wrong way
[15:58] <xnox> yes, one can do so.
[15:59] <xnox> codelotus: but you should be careful about how many times all of that forks and be aware of getting the expect stanza correct.
[15:59] <codelotus> xnox: ok, thanks
[15:59] <xnox> codelotus: the "status yourjob" should show the same pid, as you would expect, from looking at the "main" process in ps output.
[16:00] <xnox> codelotus: there are examples of running java daemons here: http://upstart.ubuntu.com/cookbook/#run-a-java-application
[16:00] <xnox> but that's without using a shell script.
[16:01] <codelotus> right, I was able to get that example to work, i.e. putting the java -jar … in the exec stanza 
[16:01] <xnox> codelotus: i'd recommend to spawn as many process as needed and setup environmental variables in pre-start script / end script. And then in "script / end script" simply either source variables and do a single call to only start your app, such that you can run in foreground, or expect fork, or expect daemon. And correctly track the right pid.
[16:02] <xnox> codelotus: see documentation about expect http://upstart.ubuntu.com/cookbook/#expect
[16:02] <codelotus> so it is advised not to use a single *.sh script that does all of the init work and spawns the process?
[16:03] <xnox> codelotus: no, because if it forks more than twice, you will not be able to track the correct PID to stop/respawn/reload/restart your daemon.
[16:04] <codelotus> ahh, and that would be what I am doing wrong
[16:04] <codelotus> thank you sir
[16:04] <xnox> codelotus: Doing it like described in the first method here http://upstart.ubuntu.com/cookbook/#run-a-java-application
[16:05] <xnox> codelotus: is the fastest and most reliable and secure way to run java apps under upstart.
[16:05] <codelotus> xnox: I did it like that the first time, but then I tried to go down the exec /opt/app/myscript.sh route and began to smack my head against the wall
[16:06] <codelotus> xnox: thank you, I'll go back to the run-a-java-application method and utilize the pre-start block
[16:07] <xnox> codelotus: for the pre-start see for example: http://upstart.ubuntu.com/cookbook/#post-stop   in the pre-start multiple commands are executed, but the script stanza only sources variables and has the final "exec cmd..." that starts the daemon. This way the "expect fork" and "respawn" actually work correctly and restart/reload/stop work correctly as well.
[16:07] <xnox> (job example under that section)
[16:08] <codelotus> i see
[21:05] <Diranged> Can I create a user-specific upstart directory and trigger those scripts to start or stop while inside that users shell?
[23:05] <xnox> Diranged: yes, in saucy it's enabled by default. In raring it's optional. In quantal/precise there is a way to do it, but it was clunky and never advertised, but possible.
[23:06] <xnox> Diranged: see http://ifdeflinux.blogspot.co.uk/2013/04/upstart-user-sessions-in-ubuntu-raring.html
[23:17] <Diranged> interesting
[23:17] <Diranged> thank you.. reading