Contents of /mcore-src/trunk/mcore-tools/daemon/client/mcored.in
Parent Directory | Revision Log
Revision 2125 -
(show annotations)
(download)
Fri Jan 10 08:52:36 2014 UTC (10 years, 8 months ago) by niro
File size: 2466 byte(s)
Fri Jan 10 08:52:36 2014 UTC (10 years, 8 months ago) by niro
File size: 2466 byte(s)
-renamed mcored.sh -> mcored.in
1 | #!/bin/bash |
2 | |
3 | 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 |
12 | source ${MCLIBDIR}/include/daemon.global.class |
13 | source ${MCLIBDIR}/include/sessionauth.global.class |
14 | #source ${MCLIBDIR}/include/mysqlfunctions.global.class |
15 | source ${MCLIBDIR}/include/hwdetection.global.class |
16 | |
17 | # load client classes plugins |
18 | load_client_classes |
19 | |
20 | # config settings |
21 | source /etc/mcore/config.rc |
22 | #source /etc/mcore/serial |
23 | |
24 | # 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 | |
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 | NOCOLORS="false" |
55 | WEBCRLF="false" |
56 | QUIET="false" |
57 | |
58 | run=run |
59 | valid_session=no |
60 | |
61 | # tell what we are |
62 | echo "Connected to $(print_version)" |
63 | |
64 | 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 | 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*) |
88 | if valid_session |
89 | 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 | #echo "$line" >> /root/lala.log |
106 | ;; |
107 | esac |
108 | done |
Properties
Name | Value |
---|---|
svn:executable | * |