Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/daemon/client/mcored.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2052 - (show annotations) (download) (as text)
Wed May 8 11:20:11 2013 UTC (10 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 2371 byte(s)
-added print_version() function and print proper version info on connect
1 #!/bin/bash
2
3 MCLIBDIR="/usr/lib/mcored"
4
5 # globals
6 source ${MCLIBDIR}/include/daemon.global.class
7 source ${MCLIBDIR}/include/sessionauth.global.class
8 #source ${MCLIBDIR}/include/mysqlfunctions.global.class
9 source ${MCLIBDIR}/include/hwdetection.global.class
10
11 # load client classes plugins
12 load_client_classes
13
14 # config settings
15 source /etc/mcore/config.rc
16 #source /etc/mcore/serial
17
18 # import_hardware_resource()
19 # {
20 # local resource="$1"
21 # local value
22 #
23 # # special cases
24 # case ${resource} in
25 # gfxcard) value="$(get_x11_driver_modules)" ;;
26 # *) value="$(get_hwinfo --with-description ${resource})" ;;
27 # esac
28 #
29 # # if [[ ${DEBUG} = 1 ]]
30 # # then
31 # # echo "${resource}=${value}" >> /root/lala.log
32 # # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log
33 # # fi
34 # # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}"
35 #
36 # import_resource status "${ALX_SERIAL}" "${resource}" "${value}"
37 # }
38
39
40 # set_init_state()
41 # {
42 # local ip
43 # ip=$(ifconfig | grep -A1 eth0 | grep inet | sed 's/.*inet\ addr:\(.*\) Bcast.*/\1/;')
44 #
45 # }
46
47 DEBUG=1
48 NOCOLORS="false"
49 WEBCRLF="false"
50 QUIET="false"
51
52 run=run
53 valid_session=no
54
55 # tell what we are
56 echo "Connected to $(print_version)"
57
58 while [[ ${run} = run ]]
59 do
60 read line
61
62 case ${line} in
63 quit) run=quit ;;
64
65 # only react on the globals -> import|get|set|auth
66 import*) run_class ${line} ;;
67 get*) run_class ${line} ;;
68 set*) run_class ${line} ;;
69 auth*) validate_auth ${line/auth /} ;;
70 provide) valid_session && print_provide ;;
71 require) valid_session && verify_requirements ;;
72 reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;;
73 restart) valid_session && restart_service ;;
74 stop) valid_session && stop_service ;;
75 nocolors) export NOCOLORS="true" ;;
76 colors) export NOCOLORS="false" ;;
77 webcrlf) export WEBCRLF="true" ;;
78 quiet) export QUIET="true" ;;
79 # version does not need auth
80 version) print_version ;;
81 help*)
82 if valid_session
83 then
84 if [[ ${line} = help ]]
85 then
86 help_topics
87 else
88 run_class ${line}
89 fi
90 else
91 mecho "You must authenticate yourself first!"
92 mecho " auth [username] [password]"
93 fi
94 ;;
95
96 *)
97 mecho "Unkown command '${line}'"
98 mecho "Type 'help' for more information."
99 #echo "$line" >> /root/lala.log
100 ;;
101 esac
102 done

Properties

Name Value
svn:executable *