hackeron | quick upstart question - when using exec, how do I execute a process as a different user? | 01:26 |
---|---|---|
ion | A future release of Upstart will have native support for that, but for now, e.g. something like exec su -s /bin/sh -c 'exec "$0" "$@"' username -- /path/to/command [parameters…] | 01:31 |
hackeron | ion: I see, I take it if I do that, then using chdir is kind of pointless in the service config file, right? | 01:35 |
hackeron | and I created a new file /etc/init/xanview_backend.conf - how do I make it available as a service? | 01:38 |
hackeron | ah, service --status-all didn't show it, but initctl list did :) - service won't start though, where does upstart log errors? | 01:47 |
hackeron | I'm trying to do: | 01:53 |
hackeron | exec su -s /bin/bash -c 'cd /opt/xanview; exec "$0" "$@"' xanview -- python run_core.py >/tmp/logfile.txt 2>/tmp/logfile.txt | 01:53 |
hackeron | when I run it just says initctl: Job failed to start | 01:54 |
hackeron | same in syslog | 01:54 |
hackeron | no log file is created :/ | 01:54 |
hackeron | any ideas? | 01:54 |
hackeron | anyone here? | 02:16 |
ion | Please pastebin the job definition. Also, using /bin/bash there is not the best idea, as it most likely loads much more slowly than whatever /bin/sh you have. | 02:18 |
hackeron | I got it working, there was a command that failed to run on pre-start script -- now trying to make it start after postgresql | 02:19 |
hackeron | if I manually do start xanview_backend - it starts | 02:19 |
hackeron | if I restart postgresql it stops and starts | 02:19 |
hackeron | but it won't start on boot :/ | 02:19 |
hackeron | I'm using this line: start on started postgresql until stopping postgresql | 02:19 |
hackeron | and switching to sh, thanks | 02:20 |
ion | init(5) doesn’t say ‘until’ is a special word. That line means it starts on the ‘started postgresql until stopping postgresql’ event which probably never comes. | 02:21 |
ion | start on started postgresql | 02:21 |
ion | stop on stopping postgresql | 02:21 |
hackeron | thanks trying | 02:23 |
hackeron | ion: no go :( - any ideas? < http://pastie.org/1472215 | 02:26 |
hackeron | ion: it all works fine and stops/starts with postgres if I do start xanview_frontend - but it won't start on boot :( | 02:27 |
ion | postgres starts properly? | 02:28 |
hackeron | hmm, actually status postgresql says unknown but service --status-all shows [ + ] postgresql | 02:30 |
ion | service concerns sysvinit scripts, not Upstart jobs. You don’t seem to have a postgres job in your system. | 02:31 |
hackeron | service shows my xanview_frontend running - so seems to have upstart jobs as well as sysvinit? | 02:32 |
hackeron | but I'm guessing there is no such event as postgresql started | 02:32 |
hackeron | any recommendations for an equivalent? | 02:33 |
ion | A quick workaround would be adding ‘initctl emit starting-postgresql’ in /etc/init.d/postgresql-… just before the service is started and ‘initctl emit started-postgresql’ just after, as well as ‘initctl emit stopping-postgresql’ and ‘initctl emit stopped-postgresql’ around where the service is being stopped. Then use ‘start on starting-postgresql’ and ‘stop on stopped-postgresql’ in your job. | 02:35 |
hackeron | ion: oooh, very nice, thanks for that | 02:35 |
ion | Sorry, i mean ‘start on started-postgresql’ and ‘stop on stopping-postgresql’ of course. | 02:35 |
ion | You might want to do 'set -e; cd /opt/xanview; exec …' so that failure to change directory stops it from going forward. Or 'cd /opt/xanview && exec …', whichever you find nicer. | 02:39 |
hackeron | added :) | 02:40 |
hackeron | wow, that is really beautiful | 02:43 |
hackeron | thanks for your help :) | 02:43 |
ion | A future version of Upstart will transparently handle legacy sysvinit scripts, but that’s still some time away. | 02:44 |
hackeron | very nice, now I see just how much better it is compared to sysvinit :) | 02:44 |
djszapi | ion: why is upstart used in so many projects if it is in childhood ? | 09:19 |
djszapi | oops, not for ion only ovb. | 09:19 |
djszapi | * obv | 09:19 |
djszapi | How can I see pre-start exec $CSD pre-start like lines in upstart config jobs ? | 12:22 |
djszapi | I was reading on the official website exec, processing should not occur in pre/post stuff, just preparetion + cleaning | 12:22 |
=== warly_ is now known as warly | ||
ion | djszapi: Millions of Ubuntu users have been running it for years with success. | 15:26 |
JanC | upstart has all the features it needs to emulate sysvinit, so it can replace that in projects without problems | 15:33 |
JanC | then implementing more and more services as upstart jobs makes it clearer what is really needed | 15:36 |
JanC | djszapi: what you try to do seems to be something new & unpredicted, and is exactly the reason why it's a good idea to use it before it's "finished" ;) | 15:39 |
djszapi | JanC: do idea what you mean | 18:47 |
djszapi | upstart misses basic features | 18:47 |
JanC | "basic features" that aren't in most other init systems anyway? | 18:48 |
djszapi | your mean ? | 18:49 |
JanC | considering tens of millions of people have been using upstart for 3 or 4 years now, and you are the first to complain about this particular feature, it can't be "basic"? | 18:51 |
djszapi | to print out a pid is not a basic thing ? | 18:52 |
djszapi | come on :) | 18:52 |
JanC | which doesn't mean the complaint is invalid, just not "basic usage" | 18:52 |
JanC | it prints a PID | 18:52 |
JanC | just not the one you want ;) | 18:52 |
djszapi | rotfl :D | 18:52 |
hackeron | djszapi: it also misses being able to start a process as a different user :) - it misses loads of vital basic little things, but it's still the best we've got :) | 18:53 |
djszapi | not for me | 18:53 |
djszapi | audit is bette for me right now | 18:53 |
hackeron | link? | 18:53 |
djszapi | sorry, but I am at home and I would like to focus for the KDE project :) | 18:53 |
djszapi | let us speak about it during the daytime when I spend my time in the main job :P | 18:54 |
hackeron | ok, for now, link please? | 18:54 |
djszapi | http://google.com | 18:54 |
hackeron | I tried, nothing | 18:54 |
JanC | hackeron: he needs teh PID of the shell that starts the daemon instead of the PID of the daemon | 18:54 |
djszapi | not true | 18:54 |
djszapi | not instead of the daemon | 18:55 |
JanC | well, in addition | 18:55 |
djszapi | I just need that and that is all | 18:55 |
djszapi | not a biggie. | 18:55 |
hackeron | JanC: well, he said audit does it - I can't find this audit he's talking about :/ | 18:55 |
JanC | hackeron: AFAIK he means http://people.redhat.com/sgrubb/audit/ | 18:59 |
=== mezcaler1 is now known as mezcalero |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!