Created
August 10, 2022 15:10
-
-
Save ZappaBoy/1e85ffab3394e8d7004e8c3e1322c0e2 to your computer and use it in GitHub Desktop.
Run in background aliases
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
# Run in background aliases | |
TMP_PID_PATH=/tmp/background.pid | |
function background(){ | |
echo "Running in background: $@" | |
nohup "$@" > /dev/null 2>&1 & echo $! > $TMP_PID_PATH | |
disown -a | |
} | |
alias background="background" | |
alias background-pid="cat \$TMP_PID_PATH" | |
alias background-kill="pkill -F \$TMP_PID_PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment