Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2095 - (hide annotations) (download) (as text)
Fri Sep 27 07:48:24 2013 UTC (10 years, 7 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/daemon/client/mcored.sh
File MIME type: application/x-sh
File size: 2466 byte(s)
-respect system environment
1 niro 1248 #!/bin/bash
2    
3     MCLIBDIR="/usr/lib/mcored"
4    
5 niro 2095 # respect system env (proxy settings etc)
6     if [ -e /etc/profile ]
7     then
8     source /etc/profile
9     fi
10    
11 niro 1248 # globals
12     source ${MCLIBDIR}/include/daemon.global.class
13     source ${MCLIBDIR}/include/sessionauth.global.class
14 niro 1251 #source ${MCLIBDIR}/include/mysqlfunctions.global.class
15 niro 1248 source ${MCLIBDIR}/include/hwdetection.global.class
16    
17 niro 1916 # load client classes plugins
18     load_client_classes
19 niro 1248
20     # config settings
21     source /etc/mcore/config.rc
22 niro 1344 #source /etc/mcore/serial
23 niro 1248
24 niro 1251 # import_hardware_resource()
25     # {
26     # local resource="$1"
27     # local value
28     #
29     # # special cases
30     # case ${resource} in
31     # 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 niro 1248
45    
46     # set_init_state()
47     # {
48     # local ip
49     # ip=$(ifconfig | grep -A1 eth0 | grep inet | sed 's/.*inet\ addr:\(.*\) Bcast.*/\1/;')
50     #
51     # }
52    
53     DEBUG=1
54 niro 1638 NOCOLORS="false"
55     WEBCRLF="false"
56     QUIET="false"
57 niro 1248
58     run=run
59     valid_session=no
60    
61 niro 2052 # tell what we are
62     echo "Connected to $(print_version)"
63    
64 niro 1248 while [[ ${run} = run ]]
65     do
66     read line
67    
68     case ${line} in
69     quit) run=quit ;;
70    
71     # only react on the globals -> import|get|set|auth
72     import*) run_class ${line} ;;
73     get*) run_class ${line} ;;
74     set*) run_class ${line} ;;
75     auth*) validate_auth ${line/auth /} ;;
76 niro 1305 provide) valid_session && print_provide ;;
77     require) valid_session && verify_requirements ;;
78 niro 2004 reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;;
79 niro 1916 restart) valid_session && restart_service ;;
80 niro 2005 stop) valid_session && stop_service ;;
81 niro 1305 nocolors) export NOCOLORS="true" ;;
82 niro 2006 colors) export NOCOLORS="false" ;;
83 niro 1305 webcrlf) export WEBCRLF="true" ;;
84 niro 1638 quiet) export QUIET="true" ;;
85 niro 2044 # version does not need auth
86 niro 2052 version) print_version ;;
87 niro 1248 help*)
88 niro 1305 if valid_session
89 niro 1248 then
90     if [[ ${line} = help ]]
91     then
92     help_topics
93     else
94     run_class ${line}
95     fi
96     else
97     mecho "You must authenticate yourself first!"
98     mecho " auth [username] [password]"
99     fi
100     ;;
101    
102     *)
103     mecho "Unkown command '${line}'"
104     mecho "Type 'help' for more information."
105 niro 1894 #echo "$line" >> /root/lala.log
106 niro 1248 ;;
107     esac
108     done

Properties

Name Value
svn:executable *