Skip to content

Instantly share code, notes, and snippets.

@joelnet
joelnet / once.sh
Created May 30, 2019 05:13
Shell script to execute a command once (while running)
#!/bin/bash
pidfile=$1
cmd=$2
if [ -z "$pidfile" ] || [ -z "$cmd" ]; then
echo "Usage: once <pidfile> \"<command>\""
exit 0
fi