Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/mcored.in

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

revision 1248 by niro, Wed Feb 2 20:20:24 2011 UTC revision 2095 by niro, Fri Sep 27 07:48:24 2013 UTC
# Line 2  Line 2 
2    
3  MCLIBDIR="/usr/lib/mcored"  MCLIBDIR="/usr/lib/mcored"
4    
5    # respect system env (proxy settings etc)
6    if [ -e /etc/profile ]
7    then
8     source /etc/profile
9    fi
10    
11  # globals  # globals
12  source ${MCLIBDIR}/include/daemon.global.class  source ${MCLIBDIR}/include/daemon.global.class
13  source ${MCLIBDIR}/include/sessionauth.global.class  source ${MCLIBDIR}/include/sessionauth.global.class
14  source ${MCLIBDIR}/include/mysqlfunctions.global.class  #source ${MCLIBDIR}/include/mysqlfunctions.global.class
15  source ${MCLIBDIR}/include/hwdetection.global.class  source ${MCLIBDIR}/include/hwdetection.global.class
16    
17  # client specific  # load client classes plugins
18  for i in ${MCLIBDIR}/include/*.client.class  load_client_classes
 do  
  source ${i} || echo "error loading ${i}"  
 done  
19    
20  # config settings  # config settings
21  source /etc/mcore/config.rc  source /etc/mcore/config.rc
22  source /etc/mcore/serial  #source /etc/mcore/serial
   
 import_hardware_resource()  
 {  
  local resource="$1"  
  local value  
   
  # special cases  
  case ${resource} in  
  gfxcard) value="$(get_x11_driver_modules)" ;;  
  *) value="$(get_hwinfo --with-description ${resource})" ;;  
  esac  
23    
24  # if [[ ${DEBUG} = 1 ]]  # import_hardware_resource()
25  # then  # {
26  # echo "${resource}=${value}" >> /root/lala.log  # local resource="$1"
27  # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log  # local value
28  # fi  #
29  # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}"  # # special cases
30    # case ${resource} in
31   import_resource status "${ALX_SERIAL}" "${resource}" "${value}"  # gfxcard) value="$(get_x11_driver_modules)" ;;
32  }  # *) value="$(get_hwinfo --with-description ${resource})" ;;
33    # esac
34    #
35    # # if [[ ${DEBUG} = 1 ]]
36    # # then
37    # # echo "${resource}=${value}" >> /root/lala.log
38    # # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log
39    # # fi
40    # # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}"
41    #
42    # import_resource status "${ALX_SERIAL}" "${resource}" "${value}"
43    # }
44    
45    
46  # set_init_state()  # set_init_state()
# Line 48  import_hardware_resource() Line 51  import_hardware_resource()
51  # }  # }
52    
53  DEBUG=1  DEBUG=1
54    NOCOLORS="false"
55    WEBCRLF="false"
56    QUIET="false"
57    
58  run=run  run=run
59  valid_session=no  valid_session=no
60    
61    # tell what we are
62    echo "Connected to $(print_version)"
63    
64  while [[ ${run} = run ]]  while [[ ${run} = run ]]
65  do  do
66   read line   read line
# Line 64  do Line 73  do
73   get*) run_class ${line} ;;   get*) run_class ${line} ;;
74   set*) run_class ${line} ;;   set*) run_class ${line} ;;
75   auth*) validate_auth ${line/auth /} ;;   auth*) validate_auth ${line/auth /} ;;
76   provide) print_provide ;;   provide) valid_session && print_provide ;;
77     require) valid_session && verify_requirements ;;
78     reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;;
79     restart) valid_session && restart_service ;;
80     stop) valid_session && stop_service ;;
81     nocolors) export NOCOLORS="true" ;;
82     colors) export NOCOLORS="false" ;;
83     webcrlf) export WEBCRLF="true" ;;
84     quiet) export QUIET="true" ;;
85     # version does not need auth
86     version) print_version ;;
87   help*)   help*)
88   if validate_session   if valid_session
89   then   then
90   if [[ ${line} = help ]]   if [[ ${line} = help ]]
91   then   then
# Line 83  do Line 102  do
102   *)   *)
103   mecho "Unkown command '${line}'"   mecho "Unkown command '${line}'"
104   mecho "Type 'help' for more information."   mecho "Type 'help' for more information."
105   echo "$line" >> /root/lala.log   #echo "$line" >> /root/lala.log
106   ;;   ;;
107   esac   esac
108  done  done

Legend:
Removed from v.1248  
changed lines
  Added in v.2095