LoginSignup
2
2

More than 5 years have passed since last update.

プロセスを検索してkillする

Posted at

勝手にapache入れて動かしてる友人がむかついたので書いた

loop do
    res = `sudo ps aux | grep apache`.split("\n")
    res.each do |row|
        pid = row.split[1]
        `sudo kill -9 #{pid} > /dev/null 2>&1`
        puts "installed http://rubygems.jp/#{pid}" if $?.exitstatus == 0
    end
    sleep 10
end
2
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2