#!/bin/bash pid=$(ps aux | grep '[0-9] node app.js' | while read user pid rest; do echo $pid; done) if [[ "$pid" != "" ]]; then kill $pid fi