Skip to content

Instantly share code, notes, and snippets.

@crazylion
Created November 16, 2011 06:32
Show Gist options
  • Save crazylion/1369427 to your computer and use it in GitHub Desktop.
Save crazylion/1369427 to your computer and use it in GitHub Desktop.
init.d
#!/bin/bash
start(){
echo "start listening fssm"
/etc/xxx/listen.rb &
}
stop(){
echo "stop listening fssm"
killall listen.rb
}
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting dimensionplus fssm"
log_progress_msg "Starting dimensionplus fssm"
start
log_end_msg "$?"
exit 0
;;
stop)
log_daemon_msg "Stoping dimensionplus fssm"
log_progress_msg "Stop dimensionplus fssm"
stop
log_end_msg "$?"
exit 0
;;
reload|restart|force-reload)
stop
start
exit 0
;;
**)
echo "Usage: $0 {start|stop|reload}" 1>&2
exit 1
;;
esac
@zx1986
Copy link

zx1986 commented Nov 16, 2011

好帖我頂啊 ~~~

listen.rb 是 fssm 的 script 嗎?

這個很漂亮啊!
/lib/lsb/init-functions 是 Linux 的 init function library 嗎?完全不知道這東西,haha!
log_* 那些東西是其中的 functions 嗎?

@crazylion
Copy link
Author

對阿 listen.rb 就是你自己寫的fssm 的ruby script

是給 init用的函式庫(對不起 我在幹啥, 這不是很直白了嗎)

log_* 那個就是會顯示 start ... success.. stop success 的 輔助顯示用函式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment