8

I have an Upstart conf file in /etc/init which starts fine if i start it manually like this:

sudo initctl start myconf

If i run it without the sudo command i get the error name=(unset) error, which is due to user privileges, but that shouldn't be the problem when the job is initialised at system boot when Upstart kicks in right? (because thats all run by the root).

The content of the script is:

start on runlevel [2345]
stop on runlevel [^2345]

exec /spatial/server_init.sh

...where the server_init.sh runs a python script based server. When i check the status of the script right after i login to shell, it says stop/waiting. I also tried the conf file with "start on net-device-up" but nothing changes. Is there a way to see the Upstart system log or something similar that might help me debug the problem.

Thanks

1
  • Sometimes if you have a chdir in your upstart script and that dir doesn't exist, no log will be written and you'll get the cryptic message: start: Job failed to start Nov 14, 2014 at 16:38

3 Answers 3

13

Try:

/var/log/upstart/JOBNAME.log

You may want to consider converting it to a task while you debug it.

start on spatial-start

task

exec /spatial/server_init.sh

then from the console:

initctl emit spatial-start
initctl status spatial-start
2
  • Will also give it a shot, thanks. I assume this actually outputs Upstart specific issues; does it include syntax errors in conf files also?
    – U2ros
    Oct 30, 2012 at 19:41
  • This is where stdout/err is redirect so it had better be verbose.
    – ppetraki
    Oct 30, 2012 at 20:20
1

Okay, found one way, but it only works if the error happens in the program that is being executed by the script (and if that program of course returns error messages), not Upstart itself, but that is what i needed in this case. What i did was redirect the program output to a log file like this:

exec /spatial/server_init.sh >> /spatial/ogc.log 2>&1

As for the other i found out you can increase Upstart verbosity so if i ll need that, i ll start from there.

0
  1. Check that the upstart directory exist : /var/log/upstart (if not then create the directory)
  2. Check your upstart version by : initctl version or apt-cache policy upstart

    For all versions of Upstart prior to v1.4, the default value for console was console none. As of Upstart 1.4, the default value is console log.

  3. Add console log into you upstart (before the script phase)
  4. Your log will be at : /var/log/upstart/"upstart-JOBNAME".log

Example :

console log

script

exec /spatial/server_init.sh

end script

Console log - Connects standard input to /dev/null. Standard output and standard error are connected to one end of a pseudo-terminal such that any job output is automatically logged to a file in directory /var/log/upstart/ for System Jobs and $XDG_CACHE_HOME/upstart/ (or $HOME/.cache/upstart/ if $XDG_CACHE_HOME is not set) for Session Jobs.

Console none - Connects the job's standard input, standard output and standard error file descriptors to /dev/null.

For more info about console look at the link below:

http://upstart.ubuntu.com/cookbook/#console-log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .