=== apachelogger is now known as javalogger
shaatarhey all, I am trying to write an upstart service (/etc/init/*.conf file). I basically want to be able to say "start flashpolicy" and execute a command that works from the command line. What I have so far is this: http://www.privatepaste.com/45189f085822:42
shaatarhowever, it does not work and I get a "start: Job failed to start."22:43
JanCshaatar: does this service need networking or something like that?22:45
JanCor a filesystem to be mounted, etc...22:46
shaatarJanC: yes, I suppose it does. It's accepts TCP connections over port 843 and returns a static xml file22:46
ionOr the root filesystem to be mounted in readwrite mode22:46
JanCthen you are starting it way too early22:47
shaatari see, I need to require some other services22:47
JanCshaatar: http://upstart.ubuntu.com/cookbook/ might be useful (it's a work-in-progress still, but some info you need is there already)22:49
shaatarI haven't actually tested this on boot yet, however. I am just trying to run $ start flashpolicy. Wouldn't networking have already loaded? Unless I am misunderstanding this.22:49
shaatarJanC: thanks, I was looking at that, I shall look into it some more.22:49
shaatarshould my command be in a script stanza?22:50
JanCyou are right that networking is probably up by that time, yes22:50
shaatarI will require it anyways, better safe than sorry.22:50
JanCmaybe something is wrong with the command you run?22:51
ionAnything in the daemon’s logs? Anything in its output? (exec >/tmp/flashpolicy.out 2>&1 before running the service)22:51
shaatarion: Like this? root@dev:/etc/init# >/tmp/flashpolicy.out 2>&122:55
shaatarroot@dev:/etc/init# start flashpolicy22:55
ionNo, in the script section of the job.22:56
ionexec >/tmp/flashpolicy.out 2>&122:56
shaatarJanC: I can run the command copy + pasted into the command line.22:56
shaatarAH I see, sorry about that22:56
shaatarhmm, interesting, it says "erlexec: HOME must be set"22:58
shaatarlooks like more of an erlang configuration issue. what user does upstart execute commands as?22:58
shaatarinteresting, the command definitely runs as root from bash. looks like google has some info on this error though, thanks all!22:59
ionI use “exec su -c 'exec …' username” for an Erlang service.23:00
ionThe PAM session sets HOME etc.23:00
shaatarwhere username is just some other user, say, a user I create called flashpolicy?23:01
ionfor instance23:01
shaatarexec su -c 'exec rl -pa /opt/flashpolicy/ebin -noshell -noinput -detached -flashpolicy logfile_path '"/var/log/flashpolicy/"' -run flashpolicy_app start'23:10
shaatardoes that look good? except for my *erl typo23:10
shaatarah, that appears to have at least run the command, excellent!23:12
shaatarthank you muchly23:12
ionYou have mismatched quotes.23:12
ionexec su -c 'exec "$0" "$@"' username -- erl -pa … should take care of it.23:13
shaatarI do?23:13
ionMight as well add -s. exec su -s /bin/sh -c 'exec "$0" "$@"' username -- erl -pa …23:14
shaatarwhat does "$0" "$@"' do?23:15
ion# su -s /bin/sh -c 'printf "|%s|" exec "$0" "$@"' ion -- foo bar 'baz quux'23:16
ion|exec||foo||bar||baz quux|23:16
shaatarAh, I see23:17
shaatarone last q: 'username', replace that with an actual username? I don't think so based on what I understand of su23:17
ionYes, whatever user you want to service to run as.23:18
shaatarah, understood23:18
shaatari need to learn more about su then :P23:18

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!