Using bgrun to run a command in background
Yesterday I wrote a script to create backups for my server. Just when I ran the script, I realised it would take an hour to complete.
It was 7pm. I needed to leave for home.
I cursed myself for not doing bgrun bash backup.sh
instead of bash backup.sh
.
The thing is bgrun
doesn’t exist.
The closest thing I found was:nohup your_command > output.log 2>&1 & disown
.
Let’s break it down:
nohup
= no hangupyour_command
= anything likebash backup.sh
> output.log
= put the output of the …