|
1 year ago | |
---|---|---|
README.md | 1 year ago |
How to create a looped command in linux, that will run permanently in the background.
You must have a basic understanding of Linux to be able to follow this tutorial. I will not help with basic requests such as "how do I change directory".
touch loop.sh
- Creates an empty file called loop.sh
in the current directory.nano loop.sh
- Opens the file in the nano editor, feel free to use vim or your other favourite text editor.#!/bin/bash
while true
do
mycommandhere
sleep 1
done
mycommandhere
with your command. It may be python run.py
or something else, but make sure you take into account file paths when specifying where a file is.bash loop.sh
or /bin/bash loop.sh
./bin/bash loop.sh &>/dev/null &
. There are some caveats with this, so here's some links: