Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/include/daemon.global.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2243 by niro, Mon Jan 13 09:27:41 2014 UTC revision 2302 by niro, Mon Jan 20 14:02:27 2014 UTC
# Line 8  load_client_classes() Line 8  load_client_classes()
8   # client specific   # client specific
9   for i in $(find ${MCORE_LIBDIR}/include -type f -name \*.client.class)   for i in $(find ${MCORE_LIBDIR}/include -type f -name \*.client.class)
10   do   do
11   source ${i} || eecho "error loading ${i}"   include ${i} || eecho "error loading ${i}"
12   done   done
13  }  }
14    
# Line 28  stop_service() Line 28  stop_service()
28   local pid   local pid
29   for pid in $(pidof sslsvd)   for pid in $(pidof sslsvd)
30   do   do
31   kill -15 ${pid}   kill -SIGTERM ${pid}
  sleep 1  
  kill -9 ${pid}  
32   done   done
33  }  }
34    
# Line 54  stop_service() Line 52  stop_service()
52  # run_class $method $caller $argv1 $argv2 ... $argvN  # run_class $method $caller $argv1 $argv2 ... $argvN
53  run_class()  run_class()
54  {  {
55   local method="$1"   local method="${GLOBAL_ARGV[0]}"
56   local caller="$2"   local caller="${GLOBAL_ARGV[1]}"
57   local class   local class
58   local cmd   local cmd
59   local argv   local i
60     local count
61    
62   if valid_session   if valid_session
63   then   then
64   class="${caller%.*}"   class="${caller%.*}"
65   cmd="${caller#*.}"   cmd="${caller#*.}"
  argv="${@/${caller}/}" # remove caller  
  argv="${argv/${method}/}" # remove method  
66    
67  # echo "method=${method}"   # copy GLOBAL_ARGV to CLASS_ARGV array without method and caller.class
68  # echo "caller=${caller}"   unset CLASS_ARGV
69  # echo "class=${class}"   count="${#GLOBAL_ARGV[*]}"
70  # echo "cmd=${cmd}"   for (( i=2; i<count; i++ ))
71  # echo "argv=${argv}"   do
72     CLASS_ARGV[${i}-2]="${GLOBAL_ARGV[${i}]}"
73     done
74    
75    # decho "method=${method}"
76    # decho "caller=${caller}"
77    # decho "class=${class}"
78    # decho "cmd=${cmd}"
79    # decho "class argv=$(printf '\"%s\" ' ${CLASS_ARGV[*]}; printf '\n')"
80    
81   # check if class.cmd exist   # check if class.cmd exist
82   if [[ ! -z $(typeset -f "${method}"_"${class}"_"${cmd}") ]]   if [[ ! -z $(typeset -f "${method}"_"${class}"_"${cmd}") ]]
83   then   then
84   "${method}"_"${class}"_"${cmd}" ${argv}   "${method}"_"${class}"_"${cmd}"
85   else   else
86   eecho "unknown method '${method}' . class '${class}' . cmd '${cmd}'"   eecho "unknown method '${method}' . class '${class}' . cmd '${cmd}'"
87   fi   fi

Legend:
Removed from v.2243  
changed lines
  Added in v.2302