Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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