Skip to content

Instantly share code, notes, and snippets.

@Jcpetrucci
Created October 2, 2020 19:11
Show Gist options
  • Save Jcpetrucci/43cb714ad1c3a70bd6e4bdbe5675ed3e to your computer and use it in GitHub Desktop.
Save Jcpetrucci/43cb714ad1c3a70bd6e4bdbe5675ed3e to your computer and use it in GitHub Desktop.
#!/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