Created
October 2, 2020 19:11
-
-
Save Jcpetrucci/43cb714ad1c3a70bd6e4bdbe5675ed3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "${1,,}" == "install" ]]; then | |
# Call this script with argument 'install' to generate a systemd unit file. | |
cat <<-EOF | sudo dd of=/etc/systemd/system/docker-logs2journal.service | |
[Unit] | |
Description=This service reads from specified log files and outputs to systemd-journald | |
After=network.target | |
[Service] | |
ExecStart=${PWD}/$0 | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
sudo systemctl enable --now docker-logs2journal.service | |
exit 0 | |
fi | |
containerLogDirectory="/var/lib/docker/volumes/minemeld-logs/_data" | |
for file in $containerLogDirectory/minemeld-engine.log $containerLogDirectory/supervisord.log; do | |
tail -F $file & | |
done | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment