I have some upstart-started apps which log a lot of stuff... I want to be able to choose in which directory the upstart logs will be saved. The default is /var/log/upstart
.
In the upstart docs, they say I should give upstart a command-line option --logdir
.
However, upstart is started as a daemon process by the OS as far as I know, so how can you even give it command-line arguments?
The upstart process is executed by the kernel at system boot. You can configure the command to be used by the kernel using a kernel command line argument. It should look like this:
init=/sbin/init --logdir=/path/to/logfiles
While you can configure grub to pass that command line option to the kernel, you also use a simple wrapper script for that.
Copy the original init binary to a backup:
sudo cp /sbin/init{,.orig}
Then create the wrapper script:
/sbin/init:
#!/bin/bash
# Pass modified logdir option
init.orig $@ --logdir=/path/to/logfiles
And make it executable:
sudo chmod +x /sbin/init