3

I have quite a few Upstart session jobs, that, among other things, start Tor, a development web server, etc. I can use the initctl commands and their abbreviations just fine when I'm logged into the system via the GUI. However, over SSH, no Upstart command shows even the slightest hint of being aware of the session jobs. Thus:

$ cat ~/.config/upstart/tor9050.conf
description "Tor on port 9050"
start on desktop-start
stop on session-end

respawn

expect daemon
exec /usr/sbin/tor -f /home/muru/.torrc9050
$ status tor9050
status: Unknown job: tor9050
$ pgrep -fa 9050
31096 /usr/sbin/tor -f /home/muru/.torrc9050

As you can see, the session job is working fine, and if I were logged into the GUI, status tor9050 would show the expected tor9050 start/running, process 31096 output.

So: how can I get the status of, and otherwise control, an Upstart session job over SSH?

0
2

One way, which I find cumbersome, is given in the Upstart Cookbook (4.3.1.1: Joining a Session). You have to set UPSTART_SESSION:

export XDG_RUNTIME_DIR=/run/user/$(id -u)
export UPSTART_SESSION=$(initctl list-sessions | awk '{print $2; quit}')

After that, it works fine:

$ status tor9050                                                             
tor9050 start/running, process 31096
1
  • @Sneetsher ah, I forgot that the TOC gives a nicer link than the section header. Thanks!
    – muru
    Jun 16 '15 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.