Skip to content

Instantly share code, notes, and snippets.

View tsopokis's full-sized avatar

Yannis Tsopokis tsopokis

View GitHub Profile
@tsopokis
tsopokis / README.md
Last active March 10, 2023 14:00 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@tsopokis
tsopokis / README.md
Created November 10, 2022 20:06 — forked from troyfontaine/README.md
Ubiquiti USG config.gateway.json Syntax

Ubiquiti USG Advanced Configuration

Overview

Integrated DNS Overview

When using a USG with Ubiquiti's Unifi Controller software (version 5.6 and earlier), the functionality of integrating the hostnames of clients (when they request a DHCP lease) into local DNS does not appear to work as you would find with Consumer grade routers. To work around this limitation, we can add static host mappings to a configuration file that will be provisioned to the USG when either a configuration change is made or we force provisioning to the USG itself.

Non-GUI Supported Dynamic DNS Providers

I've added in the necessary syntax for adding Cloudflare DDNS to the USG for VPN/Services setup courtesy of this post by britannic on the Ubiquiti Forums.

Configuration File

@tsopokis
tsopokis / bash_pid.sh
Created August 29, 2018 10:33
Bash Script PID file locking with extra care trying to avoid simultaneous runs using a random backoff
#!/bin/bash -
set -e
scriptname=$(basename $0)
pidfile="/tmp/${scriptname}.pid"
if [ -d /var/run ] && [ -w /var/run ]; then
pidfile="/var/run/${scriptname}.pid"
fi
if [ -f $pidfile ]; then
pid=$(cat $pidfile)