How to run linux command on background in bash(shell) script ?
Hello, i just want to share this bash script code.
Please if you know any other ways to simply execute linux command from bash script on background, please kindly share, thx
# definning emptybuffer function which will sleep 3600 seconds and empty buffer file when called.
# these commands (sleep, >) will be executed on background and script can continue to run
# if there is no "sleep 3600" process running, then we execute it (function emptybuffer)
if [ "$(ps x | grep "sleep 3600" | wc -l)" -lt "2" ];then
Is this useful / helpfull?
You can just run the command like that:
Originally Posted by admin
and it will be executed in the background return some result and finished.