I used Upstart's provided example for console output.
/etc/init/test.conf
console output
pre-start script
# Perform whatever checks you like here (maybe checking
# '/etc/default/foo' to see if the service is enabled # or not).
#
# if there are no problems detected, simply "exit 0", else do
# something like this...
# display an error message to stderr *on the console* and also write
# the same message to the system log.
logger -is -t "$UPSTART_JOB" "ERROR: foo!"
# tell Upstart not to start the main process for the job.
exit 1
end script
# this service doesn't do much :-)
exec sleep 999
And then as root
$ initctl start test
initctl: Job failed to start
The message is present in /var/log/syslog
, but the message was not present in the console.
Jul 23 07:42:19 paul test[26595]: ERROR: foo!
How can I log errors to the console?
This is Ubuntu 14.04,
$ initctl version
init (upstart 1.12.1)
display an error message to stderr *on the console*
, they meandisplay an error message to stderr *on the sys admin's console*
? I'm not sure what the utility of that would be. – Wellfixed