Kill All Processes of A Particular User

Problem: I was having this problem that need to kill all processes of a user in a cron job and start the processes again using a in a particular user space.

Solution: Might not be the most elegant solution.  However, I chose to go with pkill and su.  So, a sample bash file:

#/bin/bash
/usr/bin/pkill -u userid
su - userid -c /path/to/startup

Then, just run the bash in a cron job.

Leave a Reply