Created
December 3, 2018 23:10
-
-
Save fallwith/218a5f7ccebbd70afaa364b1cc55d19a to your computer and use it in GitHub Desktop.
Run caffeinate for the duration of an ffmpeg process
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
#!/usr/bin/env bash | |
set -euo pipefail | |
ffmpeg_pid=$(ps auwx | grep ffmpeg | grep -v grep | awk '{print $2}') | |
if [ "$ffmpeg_pid" == "" ]; then | |
echo "Cannot find an ffmpeg pid!" | |
exit -1 | |
fi | |
echo "Caffeinating while pid $ffmpeg_pid runs..." | |
caffeinate -imsw $ffmpeg_pid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment