Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2243 - (hide annotations) (download)
Mon Jan 13 09:27:41 2014 UTC (10 years, 3 months ago) by niro
File size: 2580 byte(s)
-fixed spelling - unkown -> unknown
1 niro 1248 #!/bin/bash
2    
3 niro 2137 MCORE_LIBDIR="@@MCORE_LIBDIR@@"
4 niro 1248
5 niro 2095 # respect system env (proxy settings etc)
6 niro 2137 if [ -e @@SYSCONFDIR@@/profile ]
7 niro 2095 then
8 niro 2137 source @@SYSCONFDIR@@/profile
9 niro 2095 fi
10    
11 niro 1248 # globals
12 niro 2140 source ${MCORE_LIBDIR}/include/common.global.class
13 niro 2137 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 niro 1248
18 niro 1916 # load client classes plugins
19     load_client_classes
20 niro 1248
21     # config settings
22 niro 2212 source @@SYSCONFDIR@@/mcore/mcore.conf
23 niro 2137 #source @@SYSCONFDIR@@/mcore/serial
24 niro 1248
25 niro 1251 # 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 niro 1248
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 niro 1638 NOCOLORS="false"
56     WEBCRLF="false"
57     QUIET="false"
58 niro 1248
59     run=run
60     valid_session=no
61    
62 niro 2052 # tell what we are
63     echo "Connected to $(print_version)"
64    
65 niro 1248 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 niro 1305 provide) valid_session && print_provide ;;
78     require) valid_session && verify_requirements ;;
79 niro 2004 reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;;
80 niro 1916 restart) valid_session && restart_service ;;
81 niro 2005 stop) valid_session && stop_service ;;
82 niro 1305 nocolors) export NOCOLORS="true" ;;
83 niro 2006 colors) export NOCOLORS="false" ;;
84 niro 1305 webcrlf) export WEBCRLF="true" ;;
85 niro 1638 quiet) export QUIET="true" ;;
86 niro 2044 # version does not need auth
87 niro 2052 version) print_version ;;
88 niro 1248 help*)
89 niro 1305 if valid_session
90 niro 1248 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 niro 2243 mecho "Unknown command '${line}'"
105 niro 1248 mecho "Type 'help' for more information."
106 niro 1894 #echo "$line" >> /root/lala.log
107 niro 1248 ;;
108     esac
109     done