1 #!/usr/bin/execlineb -P
4 # a sane example of handling the arguments would be nice
6 # populate some variables
8 define INSTANCE_NAME jane
10 backtick HOME { homeof ${RUN_USER} }
11 importas -n -u HOME HOME
13 define LOGDIR ${HOME}/var/log/s6/imaginary_service-${INSTANCE_NAME}
14 define MAIL_FIFO ${LOGDIR}/mail_fifo
16 # redirect STDERR to STDIN so it can be caught by a logging service
19 # switch to a different user for running this
20 s6-setuidgid ${RUN_USER}
22 # the command to start and supervise
24 # prepend TAI64N timestamp
26 # prepent ISO 8601 timestamp
28 # rotate after 1MiB written
30 # total size of logdir may be 2GiB
32 # filter lines with only spaces
34 # upon rotation, send log to MAIL_RCPT
35 !"background { redirfd -r 0 ${MAIL_FIFO} mail -s \"instance log: ${INSTANCE_NAME}\" -- ${MAIL_RCPT} } tee ${MAIL_FIFO}"
36 # directory to write logfiles to