How to pkill file name with space or with command parameter string

How to pkill file name with space or with command parameter string

# more mqtt_subscribe.sh
pkill -9 -f “php artisan extraction:analyze”;
cd /www/backend.extraction/extraction/laravel;
sudo -u www-data php artisan extraction:analyze 3 > ./storage/logs/mqtt_sub.log &
tail -f ./storage/logs/mqtt_sub.log;

accordingly to the pkill man page:

  -f     The pattern is normally only matched against the process name.
          When -f is set, the full command line is used.

sudo -u www-data┬áis used to “execute a command as another user”, here the user is www-data

Leave a Reply

Your email address will not be published. Required fields are marked *