Skip to content

Instantly share code, notes, and snippets.

@NoNamePro0
Last active June 1, 2020 06:58
Show Gist options
  • Save NoNamePro0/a5c70e8efbaa83f882720a84a541e3dc to your computer and use it in GitHub Desktop.
Save NoNamePro0/a5c70e8efbaa83f882720a84a541e3dc to your computer and use it in GitHub Desktop.
Run a command in the background witch automatically rerun
#!/bin/bash
name='yourName'
command="yourCommand" # Use ${0%/*} to go in the folder from the start.sh
timeout='120'
script_path="${0}"
if [[ $1 == "--non-background" ]]
then
$command
sleep $timeout
$script_path
exit
else
screen -AmdS $name $script_path --non-background
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment