Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *