发新话题
打印

[原创]FreeBSD中rc.d脚本编程注意

[原创]FreeBSD中rc.d脚本编程注意

文章作者:Helvin

以前经常说别人,这次自己终于犯了一个不仔细阅读手册的错误

以前rc.d framework写的正常的for ports脚本现在死活启动运行不了.仔细看过手册和rc.subr才知道

the names of the “conditions” (which means services to us) it provides;

the names of the “conditions” it requires;

the names of the “conditions” this file should run before;

additional keywords that can be used to select a subset from the whole set of files (rcorder(8) can be instructed via options to include or omit the files having particular keywords listed.)
Code Language : Bash
  1. find_local_scripts_new () {
  2.         local_rc=''
  3.         for dir in ${local_startup}; do
  4.                 if [ -d "${dir}" ]; then
  5.                         for file in `grep -l '^# PROVIDE:' ${dir}/* 2>/dev/null`; do
  6.                                 case "$file" in
  7.                                 *.sample) ;;
  8.                                 *)        if [ -x "$file" ]; then
  9.                                                 local_rc="${local_rc} ${file}"
  10.                                         fi
  11.                                         ;;
  12.                                 esac
  13.                         done
  14.                 fi
  15.         done
  16. }
Parsed in 0.016 seconds
在注释中加入

# PROVIDE: myservice
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
大隐于市

TOP

Helvin也用代码发芽网么?

TOP

发新话题