Bhaveshpp

Professional Magento Developr - Healp eachother to grow

Linux: Background processing

23 Nov 2021 » linux, cmd

Run command in background

use & sign for run process in background

for ex:

find -name "post*" -print > ../test.log&

Output

bhaveshpp@bhaveshpp:~/private/bhaveshpp/stack$ find -name "post*" -print
./_layouts/post.html
./_layouts/posts_by_category.html
./.git/hooks/post-update.sample
bhaveshpp@bhaveshpp:~/private/bhaveshpp/stack$ find -name "post*" -print > ../test.log&
[1] 12311
bhaveshpp@bhaveshpp:~/private/bhaveshpp/stack$ 
[1]+  Done                    find -name "post*" -print > ../test.log

run multiple command in background sy:

$(command1;command2)&

(usr/bin/php /var/www/html/mage/bin/magento setup:upgrade;usr/bin/php /var/www/html/mage/bin/magento setup:di:compile)&

Nohangup: nohup

when user logout the shell then all background process will terminetd. nohup it ensure that background process will not die.

nohup find ./ -name "post*" -print > ../test.log&