blob: 7e8c09f9657230de196bb8fa8d60dfbf9a37ba5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#!/bin/bash
# Mostly a snippet that you can copy to other scripts
# Log stdout/stderr, but also keep them separate for use in e.g. crontab
# (redirect stdout > /dev/null without losing stderr)
exec > >(tee >(logger -t "${0##*/}"))
exec 2> >(tee /dev/stderr | logger -t "${0##*/}")
# demo
echo "stdout message"
echo "stderr message" >&2
|