How to pkill file name with space or with command parameter string
# more mqtt_subscribe.sh
pkill -9 -f “php artisan extraction:analyze”;
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