#!/bin/sh

if hash caffeinate 2>/dev/null; then
  caffeinate -w "$pid"
elif hash systemd-inhibit 2>/dev/null; then
  systemd-inhibit \
    --who=waitfor \
    --why="Awaiting PID $pid" \
    tail --pid="$pid" -f /dev/null
else
  tail --pid="$pid" -f /dev/null
fi
