=== apachelogger is now known as javalogger [22:42] hey 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/45189f0858 [22:43] however, it does not work and I get a "start: Job failed to start." [22:45] shaatar: does this service need networking or something like that? [22:46] or a filesystem to be mounted, etc... [22:46] JanC: yes, I suppose it does. It's accepts TCP connections over port 843 and returns a static xml file [22:46] Or the root filesystem to be mounted in readwrite mode [22:47] then you are starting it way too early [22:47] i see, I need to require some other services [22:49] shaatar: 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] I 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] JanC: thanks, I was looking at that, I shall look into it some more. [22:50] should my command be in a script stanza? [22:50] you are right that networking is probably up by that time, yes [22:50] I will require it anyways, better safe than sorry. [22:51] maybe something is wrong with the command you run? [22:51] Anything in the daemon’s logs? Anything in its output? (exec >/tmp/flashpolicy.out 2>&1 before running the service) [22:55] ion: Like this? root@dev:/etc/init# >/tmp/flashpolicy.out 2>&1 [22:55] root@dev:/etc/init# start flashpolicy [22:56] No, in the script section of the job. [22:56] exec >/tmp/flashpolicy.out 2>&1 [22:56] JanC: I can run the command copy + pasted into the command line. [22:56] AH I see, sorry about that [22:58] hmm, interesting, it says "erlexec: HOME must be set" [22:58] looks like more of an erlang configuration issue. what user does upstart execute commands as? [22:58] root [22:59] interesting, the command definitely runs as root from bash. looks like google has some info on this error though, thanks all! [23:00] I use “exec su -c 'exec …' username” for an Erlang service. [23:00] The PAM session sets HOME etc. [23:01] where username is just some other user, say, a user I create called flashpolicy? [23:01] for instance [23:10] exec su -c 'exec rl -pa /opt/flashpolicy/ebin -noshell -noinput -detached -flashpolicy logfile_path '"/var/log/flashpolicy/"' -run flashpolicy_app start' [23:10] does that look good? except for my *erl typo [23:12] ah, that appears to have at least run the command, excellent! [23:12] thank you muchly [23:12] You have mismatched quotes. [23:13] exec su -c 'exec "$0" "$@"' username -- erl -pa … should take care of it. [23:13] I do? [23:14] Might as well add -s. exec su -s /bin/sh -c 'exec "$0" "$@"' username -- erl -pa … [23:14] gotcha [23:15] what does "$0" "$@"' do? [23:16] # su -s /bin/sh -c 'printf "|%s|" exec "$0" "$@"' ion -- foo bar 'baz quux' [23:16] |exec||foo||bar||baz quux| [23:17] Ah, I see [23:17] one last q: 'username', replace that with an actual username? I don't think so based on what I understand of su [23:18] Yes, whatever user you want to service to run as. [23:18] ah, understood [23:18] i need to learn more about su then :P