Cleanup 一个清理所有节点进程的小Script - XiZi's Blog

Cleanup 一个清理所有节点进程的小Script

Xizi posted @ 2014年3月18日 23:10 in 未分类 with tags bash expect cluster , 2625 阅读
#!/bin/bash
if [ x$1 = x ]; then
    echo "use $0 processname to kill all named process on all active nodes."
    exit
fi

activenodes=$(shownodes | sed -n 's/\(c[0-9]\{4\}-[0-9]\/8\)/\1/gp' | sed -n 's/ /\n/pg' | sed -n 's/.*\(c[0-9]\{4\}\)-[0-9]\/8.*/\1/gp')
#echo $activenodes

#run Expect
/usr/bin/expect -<<EOD
foreach node {
$activenodes
} {
#循环,可以多台相同密码的服务器同时处理,不同密码的需要改动一下,在下面再加一个密码的循环,
spawn rsh \$node
expect {
"*(yes/no)*" { send "yes\r"}
"password:" { send "password\r" }
}            #SSH第一次远程登录服务器
expect "username*"
#send "su -\r"        #SSH普通用户名密码登录
#expect "Password:"
#send "123456\r"        #SSH的root用户名密码登录
#expect -timeout 1
#expect "root"
send "ps aux | grep $1 \r"
send "killall -9 $1 \r"
#send "echo helloworld \r"
#expect "username"
send "exit \r"
}
EOD

echo "Completed"

updated but not tested one

#!/bin/bash
if [ x$1 = x ]; then
    echo "use $0 processname to kill all named process on all active nodes."
    exit
fi

activenodes=$(shownodes | sed -n 's/\(c[0-9]\{4\}-[0-9]\/8\)/\1/gp' | sed -n 's/ /\n/pg' | sed -n 's/.*\(c[0-9]\{4\}\)-[0-9]\/8.*/\1/gp')
#echo $activenodes
logfile="$HOME/bin/cleanup.log"
echo "" > $logfile
#run Expect
/usr/bin/expect -<<EOD
foreach node {
$activenodes
} {
#循环,可以多台相同密码的服务器同时处理,不同密码的需要改动一下,在下面再加一个密码的循环,
spawn rsh \$node
expect {
"*(yes/no)*" { send "yes\r"}
"password:" { send "password\r" }
}            #SSH第一次远程登录服务器
expect "usename*"
#send "su -\r"        #SSH普通用户名密码登录
#expect "Password:"
#send "123456\r"        #SSH的root用户名密码登录
#expect -timeout 1
#expect "root"
send "echo \\\$HOSTNAME >> $logfile \r"
send "ps aux | grep $1 | grep -v grep >> $logfile \r"
send "killall -9 $1 \r"
#send "echo helloworld \r"
#expect "sofair"
send "exit \r"
}
EOD

echo "Completed"
echo "Logs are Saved to $logfile"
Avatar_small
what is a webinar 说:
2020年8月20日 11:13

Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post <a href="https://webinarcare.com/">what is a webinar</a>

Avatar_small
UMAIR 说:
2021年1月19日 23:17

The previous question papers of JKBOSE Class 10th helps to findout the question level and answering skills of every student. To rectify their problems in Mathematics subject and retake their test to improve their knowledge in Jammu & Kashmir Class 10th Std Board Examination.J&K 10th Summer and Winter Model Paper 2021 Use the Upload the JKBOSE Board Class 10th Model Question Paper 2021 Pdf here. Its the right plan to estimate their studies for increase their well preparation along with the Syllabus & Exam Pattern.

Avatar_small
UMAIR 说:
2021年1月29日 19:13

This is some thing very informative and point to point. There is no round and round in this article. Like this smplicity . This clears my old point of view. THANKS sa gaming

Avatar_small
UMAIR 说:
2021年2月02日 00:59

This is some thing very informative and point to point. There is no round and round in this article. Like this smplicity . This clears my old point of view. THANKS slilpp xyz shops search

Avatar_small
UMAIR 说:
2021年3月09日 19:40 This is some thing very informative and point to point. There is no round and round in this article. Like this smplicity . This clears my old point of view. THANKS pakseo.net
Avatar_small
Aaamanted 说:
2021年3月11日 14:20

Then you have the other consumers who dearly love the sneakers but refuse to part with this much cash for a pair of shoes that they’re likely to wear out <a href="https://www.yzykicks.org/">cheapest yeezys</a> in a year or two. This leads us to the very important question of why are Yeezys so expensive anyway? It took us a bit of research to find the answers to this question and it’s not just one reason. Here is what we learned.

Avatar_small
Aaamanted 说:
2021年3月11日 14:21

Is Yeezy Supply legit or not? Now, that is an excellent question. Yeezy [url=https://www.yzykicks.org/]cheapest yeezys[/url] Supply was the topic of many heated discussions, especially in 2018 and 2019. According to many dissatisfied customers, review sites, and even news reports, Yeezy Supply is not legit.

Avatar_small
메이저사이트 说:
2021年3月15日 03:04

You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers.

Avatar_small
Harry 说:
2021年8月29日 01:39

I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job!  mulberry silk bedding

Avatar_small
Elastic Dori Manufac 说:
2021年8月31日 22:06

I have visited to this site multiple times and everytime I find beneficial jobs for me so I would suggest please come to this site and take the chance from here.

Avatar_small
Harry 说:
2021年9月02日 06:22
  1. Thanks so much for posting essential information for your users well being
Avatar_small
backlinks 100% manua 说:
2021年9月03日 01:35

When you effectively inspire curiosity then naturally the visitor will want to know more. Then they will visit your blog and most probably stay a while. And that is also the difference between a Hit and an actual Visitor staying on your Blog.

Avatar_small
Sarasota Mold Pros 说:
2021年9月03日 23:15

I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks

Avatar_small
stickers 说:
2021年9月04日 03:51

This really which means delightful not to mention original. I just absolutely adore typically the styles not to mention anyone who will become it again in your mailing could be cheerful.

Avatar_small
Chris Harrold 说:
2021年9月05日 00:37

I went to this website, and I believe that you have a plenty of excellent information,I have saved your site to my bookmarks.

Avatar_small
PUC Model Paper 说:
2021年9月06日 17:29

Karnataka is announced 1st and 2nd year PUC study material with sample model question paper (Kar PUC Model Paper 2022) with new exam question pattern for Kannada medium and English medium Arts, Science and Commerce stream general and vocational course students to the academic year of 2022. PUC Model Paper Students of Pre University Education can download Kar 1st and 2nd PUE Model Paper 2022 with subject wise study material & model set and mock test question paper for theory, objective type multiple choice questions (MCQ), Bit Paper with suggested answer solutions for all subjects.

Avatar_small
how do i tell if he 说:
2021年9月07日 00:07

Appreciate it intended for placing a really good document! I stumbled upon your blog perfect for the desires. Its full of superb in addition to very helpful threads. Sustain the favorable do the job!

Avatar_small
พีจีสล็อต 说:
2021年9月07日 01:06

It a fabulous blog post As i looked at caused by have the application. Advise everything that Need be to find expectation on potential future you certainly will persist designed for writing a great wonderful blog post.

Avatar_small
Harry 说:
2021年9月10日 23:32

Thanks a lot pertaining to putting up a real wonderful content! I ran across your web site ideal for our requires. Its content has amazing along with valuable blogposts. Carry on the excellent operate! email marketing services

Avatar_small
ping pong balls 说:
2021年9月11日 00:22

We have not too long ago started out any website, the knowledge an individual offer on this web site provides aided myself tremendously. Thank you regarding your entire moment & perform.

Avatar_small
boston mortgage 说:
2021年9月11日 23:53

Truly My spouse and i go through the idea recently nevertheless I had created a number of views over it and from now on I want to you just read the idea yet again since it is rather well crafted.

Avatar_small
slotxo ทดลองเล่น 说:
2021年9月12日 23:35

You have done a great job. I will definitely dig it and personally recommend to my friends. I am confident they will be benefited from this site

Avatar_small
pensacola fishing ch 说:
2021年9月13日 23:40

Stick to the fantastic job, That i look over couple articles or blog posts on this subject web-site together with It is my opinion that online webpage is certainly legitimate appealing and features have communities for superb material.

Avatar_small
Manipur 12th Model P 说:
2021年9月14日 18:30

Manipur class 11th and 12th standard students can download subject wise new syllabus question paper with answer solutions for Arts, Science, Commerce stream 1st and 2nd-year HSC examination tests for 1st language, 2nd language, 3rd language with all other subjects of Higher Secondary Education under COHSEM, the subject expert of the board provided new syllabus practice question paper along with answering key solutions for both medium students of the board. Manipur 12th Model Paper Every student can download COHSEM Model Paper 2022 for paper-1 and paper-2 examination test theory, objective, Multiple choice questions for English medium, Hindi medium, Bengali medium class 11th, and 12th standard students.

Avatar_small
upload reels to inst 说:
2021年9月26日 23:14

I can’t believe focusing long enough to research; much less write this kind of article. You’ve outdone yourself with this material without a doubt. It is one of the greatest contents.

Avatar_small
Disposable Scrub Sui 说:
2021年10月01日 23:26

This is exactly what I was looking for. Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this!

Avatar_small
Harry 说:
2021年10月05日 05:28

I really enjoy the blog article. Really looking forward to read more. Keep writing. qiu online

Avatar_small
Adilkhatri 说:
2021年10月05日 21:48

You may comment on the demand plan of the blog. You should visit it's mind boggling. Your blog audit would swell up your visitors. I was to a great degree fulfilled to find this site.I expected to thank you for this unimaginable read!! 바카라사이트

Avatar_small
click here for more 说:
2021年10月05日 23:59

I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.

Avatar_small
Harry 说:
2021年10月06日 00:05

Nice to read your article! I am looking forward to sharing your adventures and experiences. coffee grinder

Avatar_small
Backlinks 说:
2021年10月06日 05:28

Wow, this is really interesting reading.I am glad I found this and got to read it.Great job on this content.I like it.

Avatar_small
customer support out 说:
2021年10月08日 01:27

Thank you so much for such a well-written article. It’s full of insightful information. Your point of view is the best among many without fail.For certain, It is one of the best blogs in my opinion.

Avatar_small
Charvel Rebagay 说:
2021年10月09日 05:14

Online is definitely bogged all the way down by using bogus blogs and forums devoid of serious principles although the posting appeared to be brilliant plus definitely worth a learn. Thanks a ton to get spreading the following with me.

Avatar_small
ทางเข้าpg 说:
2021年10月09日 23:17

Ones new music is usually wonderful. You could have many incredibly proficient painters. When i hope people the most beneficial connected with achievements.

Avatar_small
merckseo 说:
2021年10月10日 06:32

Best Social Plan is the most trusted company for providing social media marketing services. Within some years it has gained popularity as a reliable company to its customers. This company is now managing its activity successfully. It is proved number one company by its quality services. It is noticed that more and more customers are showing their intention to take service from this company. Best Social Plan

Avatar_small
wildlife control 说:
2021年10月16日 23:43

Common outings let us discuss simplest way to thanks a ton for your personal efforts, which will is why I'm just checking out the positioning on a daily basis, interested in innovative, helpful information and facts. Lots of, thanks a lot!

Avatar_small
Harry 说:
2021年10月20日 00:03

Nice to read your article! I am looking forward to sharing your adventures and experiences. hoverboards world

Avatar_small
concrete contractor 说:
2021年10月21日 05:30

I just now idea it can be a notion to share incase anybody else seemed to be experiencing difficulty investigating although My business is a bit undecided plainly was allowed to fit bands in addition to deals with with in this article.

Avatar_small
Harry 说:
2021年10月21日 05:31

This is probably the results We're getting all over. With thanks for your personal site, I sign up to your website. This is usually a awesome site. inches. test udp port

Avatar_small
Dalvin Smith 说:
2021年10月21日 18:23

That gives off an impression of being brilliant anyway i am still not very beyond any doubt that I like it. At any rate will look significantly more into it and choose by and by! type iir surgical disposable face mask surgical disposable mask Disposable Scrub Suits elastic earloop earloop elastic

Avatar_small
how to watch nfr 说:
2021年10月25日 00:23

Appreciate it intended for giving new messages the matter, When i count on understand far more.

Avatar_small
silk blouses 说:
2021年11月22日 02:51

Great Publish, I'm a large believer within publishing remarks upon websites in order to allow weblog authors realize that they’ve additional some thing beneficial in order to the internet!

Avatar_small
Dalvin Smith 说:
2021年11月23日 22:49

Your blogs further more each else volume is so entertaining further serviceable It appoints me befall retreat encore. I will instantly grab your rss feed to stay informed of any updates. free porn party

Avatar_small
Harry 说:
2021年12月03日 22:10

some genuinely choice content on this internet site , saved to my bookmarks购物网站

Avatar_small
Harry 说:
2021年12月11日 04:56

I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job how to post story to instagram from pc

Avatar_small
Harry 说:
2021年12月16日 03:15 Believe it or not, it is the type of information I’ve long been trying to find. It matches to my requirements a lot. Thank you for writing this information. 파워볼사이트
Avatar_small
Harry 说:
2021年12月19日 00:08

I have as of late begun an online journal, the information you give on this website has helped me extraordinarily. Much obliged for the majority of your time and work. post to instagram from pc

Avatar_small
Harry 说:
2021年12月21日 00:40

I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. judi online24jam terpercaya 2020

Avatar_small
Harry 说:
2021年12月26日 23:12

I've never come across a blog as good as this and it's highly recommend blog 우리카지노

Avatar_small
Harry 说:
2021年12月31日 05:24

I've never come across a blog as good as this and it's highly recommend blog digital marketing west palm beach

Avatar_small
Harry 说:
2022年1月20日 06:22

It is fine, nevertheless evaluate the information and facts around this correct. qiu qiu online

Avatar_small
Harry 说:
2022年1月23日 03:08

Excellent post. I was reviewing this blog continuously, and I am impressed! Extremely helpful information especially this page. Thank you and good luck. pragmatic play indonesia

Avatar_small
where to buy real st 说:
2022年1月23日 23:50

Thank you for your article. Much thanks again. Want more.

Avatar_small
pragmatic 说:
2022年1月25日 19:52

Appreciate you sharing great post. Really looking forward to read more. Really Great.

Avatar_small
Harry 说:
2022年1月26日 02:38

This is exciting, nevertheless it is vital for you to visit this specific url: Medical Marijuana Tincture

Avatar_small
Harry 说:
2022年2月09日 03:54

I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. domino99

Avatar_small
white hat seo 说:
2022年2月14日 06:42

Fantastic post. Much thanks again. Cool.

Avatar_small
seo backlinks 说:
2022年2月16日 02:35

Very informative post. Really looking forward to read more. Awesome.

Avatar_small
seo backlinks 说:
2022年2月16日 02:48

A round of applause for your article. Much thanks again. Cool.

Avatar_small
Soghat e Sheerin 说:
2022年3月28日 23:45

This is some thing very informative and point to point. There is no round and round in this article. Like this smplicity . This clears my old point of view. THANKS Soghat-e-Sheerin Soghat Sweet Soghat Bakers Saloni Soghat Soghat Pizza

Avatar_small
DewaQQ 说:
2022年4月18日 08:55

Appreciate you sharing great article post. Really thank you! Great.

Avatar_small
best ping pong balls 说:
2022年4月19日 04:06

I loved your blog post. Really looking forward to read more.

Avatar_small
Dalvin Smith 说:
2022年4月23日 22:33

That gives off an impression of being brilliant anyway i am still not very beyond any doubt that I like it. At any rate will look significantly more into it and choose by and by! The Hiltonian Business News Entertainment News World News

Avatar_small
seoanalyzeronline 说:
2022年5月22日 10:04

A round of applause for your article. Much thanks again. Cool.

Avatar_small
M Anus Raza 说:
2022年5月22日 12:41

That gives off an impression of being brilliant anyway i am still not very beyond any doubt that I like it. At any rate will look significantly more into it and choose by and by! Breaking News Breaking News Breaking News Breaking News Breaking News

Avatar_small
NCERT 3rd Class Book 说:
2022年5月26日 04:21

NCERT 3rd Class Textbooks 2022 Available in Mathematics, Science, Social Science, English and Hindi Subjects We have Provided Latest Editions of Hindi, English, Urdu Medium All the Textbooks that are Published by the National Council of Educational Research and Training (NCERT) for the Current Academic Session 2022, SCERT and CBSE Students are Advised to Follow NCERT 3rd Class Books can be Downloaded here in PDF format. NCERT 3rd Class Book NCERT Class 3 Textbooks 2022 for Providing the best learning Platform with Various Resources to Support and enhance Educational Delivery and Management. Students Download NCERT Books 2022 for Class 3 Subject Wise and Hindi, Urdu, English Medium Wise our Website Provide Pdf Format.

Avatar_small
royal green 说:
2022年5月30日 09:03

Really appreciate you sharing this blog post. Thanks Again. Fantastic.

Avatar_small
Kampus Profetik 说:
2022年8月18日 09:25

Saya senang membaca posting Anda dan menganggapnya informatif dan sesuai dengan topik. Terima kasih untuk tidak mengoceh terus-menerus hanya untuk mengisi halaman. Terima kasih..

Avatar_small
dark web/deep web/d 说:
2022年8月20日 18:11

This will show you any content pages associated with those links. The content pages are usually informational, although sometimes they contain affiliate links to other companies. dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月20日 18:59

To find out more about links, subscribe to the newsletter called Search Engine Land. In this newsletter, you will receive important tips and information about improving your site's ranking on Google.  deep web

Avatar_small
dark web/deep web/d 说:
2022年8月20日 19:28

The Dark Net is an untapped goldmine for anyone willing to take advantage of it. The Dark Web is a part of the World Wide Web that's not visible to the common browser or search engine. dark web sites

Avatar_small
dark web/deep web/d 说:
2022年8月20日 20:02

A lot of these sites are link farms. These are websites that have hundreds of other links leading to their own page on the Web.  dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月20日 20:20

Other sites, such as those offering gambling sites, have been known to spam innocent gamers with links to their own gambling sites. dark web

Avatar_small
dark web/deep web/d 说:
2022年8月20日 20:42

The most common product an affiliate marketer sells is information products. This can be information on a new topic, an e-book, or even a manual on a particular subject.  work from home jobs

Avatar_small
dark web/deep web/d 说:
2022年8月20日 21:00

These are usually small text within the content. Many people include these within their material because they want to sell the reader something. They will usually give you a portion of the sale if they are sold. affiliate marketing success

Avatar_small
arsylatours 说:
2022年8月25日 16:59

ayo kunjungi tempat travel terbaik karimunjawa

Avatar_small
bartt 说:
2022年8月29日 03:52

Jika anda mencari situs asuransi terbaik maka kunjungi <a href="https://bartt.my.id/1168/jenis-asuransi.html/">Jenis Asuransi</a>

Avatar_small
bartt 说:
2022年8月29日 03:52

Jika anda mencari situs asuransi terbaik maka kunjungi Jenis Asuransi

Avatar_small
raja cuan 说:
2022年8月30日 03:53

ayo daftar di situs terbaik dan pasti membayar daftar rajacuan

Avatar_small
cuannn 说:
2022年9月04日 07:34

Kunjungi jasa renovasi rumah terbaik jasa renovasi rumah jakarta

Avatar_small
cuannn 说:
2022年9月04日 07:34

Kunjungi situs menjamin cuan terbaik bandar cuan777

Avatar_small
Softech Source 说:
2022年9月04日 23:37

Nicely well-written article. It was an awesome article to read. Complete rich content and fully informative Softech Source App Development Company Web Development Company Ecommerce Website Development Company Best Digital Marketing Company SEO

Avatar_small
Dalvin Brown 说:
2022年9月05日 00:38

Nicely well-written article. It was an awesome article to read. Complete rich content and fully informative Softech Source App Development Company Web Development Company Ecommerce Website Development Company Best Digital Marketing Company SEO

Avatar_small
sasadada 说:
2022年9月05日 08:29

Kunjungi Kampus prophetic university terbaik Prophetic University

Avatar_small
asdas 说:
2022年9月07日 08:45

Memu vs Nox - is Memu better than Nox? nox vs memu

Avatar_small
ASDAS 说:
2022年9月16日 00:44

daftar game slot terbaik di sumbartoto sumbartoto

Avatar_small
ASDAS 说:
2022年9月16日 00:45

slot raja cuan yang terbaik dan terpercaya slotrajacuan

Avatar_small
ASDAS 说:
2022年9月16日 00:45

ayo main game slot yang pasti membayar slot gacor

Avatar_small
ASDAS 说:
2022年9月16日 00:45

ayo main game slot yang pasti membayar slot hoki

Avatar_small
ASDAS 说:
2022年9月16日 00:46

ayo tonton film gratis terbaik film gratis i58

Avatar_small
The Hiltonian 说:
2022年9月18日 19:26

Nicely well-written article. It was an awesome article to read. Complete rich content and fully informative Business News World News Entertainment News Tech News Health News

Avatar_small
The Hiltonian 说:
2022年9月19日 05:23

Nicely well-written article. It was an awesome article to read. Complete rich content and fully informative tranny tube shemale tubes skyward fbisd fbisd skyward cam newton net worth 2021

Avatar_small
AVHSGDAS 说:
2022年9月19日 07:13

situs strategi pemasaran hanyadi Strategi Pemasaran 4P tempat belajar pemasaran di Strategi Pemasaran

Avatar_small
AVHSGDAS 说:
2022年9月19日 07:13

tempat download jurnal internasional terbaik download jurnal internasional cara download jurnal internasional cara download jurnal internasional gratis

Avatar_small
AVHSGDAS 说:
2022年9月19日 07:14

kunjugi situs slot menjamin membayar kejuslot

Avatar_small
News Record 说:
2022年9月25日 15:19

This is some thing very informative and point to point. There is no round and round in this article. Like this smplicity . This clears my old point of view. THANKS unblocked shooting games bird box 2 release date uk bird box 2 release date behind the ear tattoos men ear tattoos men

Avatar_small
NCERT Urdu Sample Pa 说:
2022年9月28日 06:11

Urdu prose and poetry have a lot of work in history. When kids learn it, they get to learn a lot about our history. Our kids must learn about our rich history. To be able to grasp the present, NCERT Urdu Sample Paper Class 11 we must know the past well.Urdu learning can help kids gain a lot of cultural knowledge. The work of Urdu prose and poetry is the best source for the kids to learn about our values and norms.Urdu prose and poetry have a lot of work in history. When kids learn it, they get to learn a lot about our history.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee