詳しくは あたりで。
で、起動scriptが欲しいので、Serf SysV Init script usage: # /sbin/chkconfig --add serf # /sbin/chkconfig serf on # /sbin/service serf startを使ってみる。が、Ubuntuだとエラーになってしまう。
/etc/rc.d/init.d/functions
はないので削除。killproc
はkillとpgrepで書き換えてみる。
FreeBSD用起動script。serfの実行ファイルが
/usr/local/bin/
にあることを想定。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Startup script for Serf | |
# PROVIDE: serf | |
# REQUIRE: DAEMON | |
# KEYWORD: shutdown | |
# | |
serf_enable=${serf_enable:-"NO"} | |
. /etc/rc.subr | |
serf_config=${serf_config:-"/usr/local/etc/serf.conf"} | |
name="serf" | |
rcvar=serf_enable | |
start_cmd="${name}_start" | |
stop_cmd="${name}_stop" | |
serf_start() | |
{ | |
echo -n " Starting Serf" | |
/usr/local/bin/serf agent -config-file=${serf_config} > /var/log/${name}.log 2>&1 & | |
} | |
serf_stop() | |
{ | |
echo -n " Stopping Serf" | |
kill -INT `pgrep ${name}` | |
} | |
load_rc_config $name | |
run_rc_command "$1" |
/usr/local/bin/
にあることを想定。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>serf</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/serf</string> | |
<string>agent</string> | |
<string>-config-file=/usr/local/etc/serf.conf</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>WorkingDirectory</key> | |
<string>/var/run</string> | |
<key>StandardErrorPath</key> | |
<string>/var/log/serf.log</string> | |
</dict> | |
</plist> |
- HomebrewなどでGNU sedをgsedとしてインストール。それを使うようにする。
/bin/sh
だとecho -e
が効かないようなので、/bin/bash
に変更。