#Kill all user procs bash 'kill_user' do code <<-EOH pkill -9 -u user exit 0 EOH only_if 'grep user /etc/passwd', :user => 'user' end