さっそくですが,daemontoolsをインストールしてみましょう.
とりあえずはこのページの通りに,現時点での最新版を落として展開します.
# sudo -i # curl -O http://cr.yp.to/daemontools/daemontools-0.76.tar.gz # tar zxvf daemontools-0.76.tar.gz # cd admin/daemontools-0.76
手順に従ってインストールしてみます.
# ./package/install Linking ./src/* into ./compile... Compiling everything in ./compile... ./load envdir unix.a byte.a /usr/bin/ld: errno: TLS definition in /lib64/libc.so.6 section .tbss mismatches non-TLS reference in envdir.o /lib64/libc.so.6: could not read symbols: Bad value collect2: ld はステータス 1 で終了しました make: *** [envdir] エラー 1ダメでした...現在のdaemontoolsは,インストールする前にパッチを当てる必要があります.パッチはここにあります.
# curl -O http://djbware.csi.hu/patches/daemontools-0.76.errno.patch # patch -p1 < daemontools-0.76.errno.patch patching file src/error.h
再挑戦します.
# ./package/install ... Copying commands into ./command... Creating symlink daemontools -> daemontools-0.76... Making command links in /command... Making compatibility links in /usr/local/bin... Creating /service... Adding svscanboot to inittab... init should start svscan now.
今度は成功しました.
さて,本来はこの時点で/etc/inittabにsvscanbootというコマンドが実行されるように書き込まれ,svscanというプログラムが実行されているはずなのですが,なぜか私の環境では(再起動しても)動きませんでした.
そこで,svscanの起動を直接制御できるよう,/etc/init.d/以下に,起動スクリプトを作成しました.
#!/bin/sh . /etc/init.d/functions PATH=/usr/local/bin:$PATH start() { if [ -e /var/lock/subsys/svscan ]; then action "svscan lockfile exists /var/lock/subsys/svscan: " /bin/false else action "Starting svscan: " /bin/true touch /var/lock/subsys/svscan exec env - PATH="$PATH" \ sh -c 'svscan /service & echo $! > /var/run/svscan.pid' fi } stop_each_svc() { if ls /service/* > /dev/null 2>&1; then for s in /service/*; do svc -dx $s action "Stopping $s: " /bin/true if [ -e $s/log ]; then svc -dx $s/log action "Stopping $s/log" /bin/true fi done fi } stop() { if [ -f /var/run/svscan.pid ]; then kill `cat /var/run/svscan.pid` stop_each_svc rm -f /var/run/svscan.pid rm -f /var/lock/subsys/svscan action "Stopping svscan: " /bin/true fi } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0さて,実際にサービスをdaemontools管理下に入れてみます.動かしたいサービスのディレクトリ等に,serviceというディレクトリを作成し,runという名前の実行可能スクリプトを配置します.このスクリプトにはサービスの起動に必要な処理を記述します.
$ sudo su - bot $ mkdir some_bot/service $ vi some_bot/service/run
#!/bin/sh cd /home/bot/some_bot # サービスディレクトリに移動 exec ./bin/bot.pl 2>&1 # サービスを起動するコマンド
$ chmod +x some_bot/service/runこのserviceディレクトリが,daemontoolsにとっての1つの管理対象になります.runスクリプトを作成したら,/serviceディレクトリに,シンボリックリンクを作成します.
$ sudo ln -s /home/bot/some_bot/service /service
svscanは5秒に1度/serviceを参照するため,これで5秒以内にはrunスクリプトが実行され,サービスが起動されます.
サービスの起動,停止,再起動は,svcコマンドで制御することができます.
$ svc -u some_bot/service # 起動 $ svc -d some_bot/service # 停止 $ svc -t some_bot/service # 再起動
23日の終わりが迫ってきてしまったので,今日はここまで...今回で終わりの予定でしたが,まだいくつか話したいことがあるのでadvent calendar終了後に最終編を書きたいと思います.
Thanks for sharing, great post!
返信削除Áo khoác Đà Lạt chuyên sỉ và lẻ áo khoác aokhoacdalat.com với giá ưu đãi nhất 2020. Luôn cập nhật mẫu mới chất lượng và dày ấm nhất kể cả với thời tiết lạnh giá các nước có du học sinh và xuất khẩu lao động. Aokhoacdalat.com được đồng hành cùng các bạn!!!!
This is incredibly charming substance! I have taken a lot of joy 일본야동
返信削除This post is good enough to make somebody understand this amazing thingngs 일본야동 target=
返信削除Love this blog!!!Thanks a lot for sharing this with all folks you actually read my mind Definitely believe that what you said. 국산야동
返信削除Thanks for sharing this marvelous post. I m very pleased to read this article. 일본야동
返信削除
返信削除You have touched some pleasant factors here. Any way keep up wrinting. 국산야동
I want to start a blog to write about everything that happens at school and
返信削除with friends…anonymously…any sugestions?.서울오피
I was impressed by your writing. Your writing is impressive. I want to write like you.온라인바둑이
返信削除
온라인카지노
返信削除I’m not sure where you are getting your info, however great topic.
I have learn several good stuff here.카지노사이트
返信削除Wonderful work! 더킹카지노
返信削除This is the type of info that are meant to be shared across the web.
Your article is very interesting. I think this article has a lot of information needed, looking forward to your 바카라사이트new posts.
返信削除We are really grateful for your blog post for 카지노사이트giving a lot of information
返信削除Nice one! Thank you for sharing this post. Your blog posts are more 토토 interesting and impressive.
返信削除Hard to ignore such an amazing article like this. You really amazed me with your writing talent. 바카라사이트Thank you for sharing again.
返信削除It's simply surprisingly open-handed of you to supply without
返信削除restraint exactly what a number of us would have marketed as an electronic book to get some bucks for their own end, primarily now
that you might have tried it if you ever decided.
Those tactics also acted to be a good way to be aware that some people have similar desire just like my own to realize a great deal more when it comes to this problem.오피
What’s up to all, it’s genuinely a fastidious for me to visit this website, it consists of priceless Information. 메이저사이트
返信削除This is very interesting, You are a very skilled blogger. 경마사이트
返信削除I have joined your feed and look forward to
返信削除seeking more of your magnificent post. Also, I’ve shared your site in my social networks! 바카라
Thanks for sharing this marvelous post. I m very pleased to read this article.
返信削除토토사이트
I think this is one of the best blog for me because this is really helpful for me. Thanks for sharing this valuable information for free Feel free to visit my website; 바카라사이트
返信削除If more people that write articles really concerned themselves with writing great content like you, more readers would be interested in their writings. Thank you for caring about your content. Feel free to visit my website; 바카라사이트
返信削除Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers Feel free to visit my website; 바카라사이트
返信削除Whats Taking place i’m new to this, I stumbled upon this I’ve discovered It positively helpful and it has aided me out loads. 토토
返信削除I’m gone to inform my little brother, that he should also pay a quick visit this blog on regular basis to obtain updated from most recent
返信削除news.
토토사이트
Chawa wins big at the 루비게임 사설바둑이사이트 모바일바둑이
返信削除Visit
返信削除www.hp.com/go/wirelessprinting and open the door to the world of HP smart printing solutions.
Visit ij.start.canon | ij.start canon and find out the best way to download Canon printer drivers.
Once you are done with the driver setup via
canon.com/ijsetup , you will have to insert a pile of pages into the printer tray for printing the documents.
Hello very nice wweb site!! Guy .. Excellent .. Wonderful .. I’ll bookmark your website and take the feeeds additionally? I am happy to find numerous helpful info right here in the publish, we need work out more strategies on this regard, thank you for sharing. Feel free to visit my website; 먹튀검증가이드
返信削除This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.Thanks for taking the time to discuss this. I feel about it and love learning more on this topic Feel free to visit my website; 배트맨토토프로
返信削除What a nice post! I'm so happy to read this. 사설토토
返信削除Nice Blog. Thanks for sharing with us. Such amazing information.
返信削除파워볼게임
It was really useful information.
返信削除I'm going to study this information a lot.
I will share useful information.
It's my website.
머니상
Thank you. I realized a lot of things using this. Thank you for always writing good things.
返信削除There are a lot of good comments on my homepage.
Please visit. It's my website.
온라인바둑이
슬롯커뮤니티
返信削除