Contents of /mcore-src/trunk/mcore-tools/src/mcore-controld.in
Parent Directory | Revision Log
Revision 2479 -
(show annotations)
(download)
Thu Sep 10 08:48:45 2015 UTC (9 years ago) by niro
File size: 2623 byte(s)
Thu Sep 10 08:48:45 2015 UTC (9 years ago) by niro
File size: 2623 byte(s)
-use 0/1 for bool values instead of mixed 0/1 and true/false settings
1 | #!/bin/sh |
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 | # include function comes with common.global class |
13 | source ${MCORE_LIBDIR}/include/common.global.class |
14 | 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/register.global.class |
18 | include ${MCORE_LIBDIR}/include/control.global.class |
19 | #include ${MCORE_LIBDIR}/include/hwdetection.global.class |
20 | |
21 | # load control classes plugins |
22 | load_classes control |
23 | |
24 | # config settings |
25 | include @@SYSCONFDIR@@/mcore/mcore.conf |
26 | |
27 | SQL_USER=alx_install |
28 | SQL_PASS=@lx |
29 | SQL_HOST=localhost |
30 | SQL_DB=alx_web |
31 | |
32 | # 0=false, 1=true |
33 | DEBUG=1 |
34 | NOCOLORS=0 |
35 | WEBCRLF=0 |
36 | QUIET=0 |
37 | |
38 | # argvs are global variables - this fixes issues with whitespaces |
39 | # global argvs, the whole command line |
40 | export GLOBAL_ARGV |
41 | # class specific argvs which are given to the class as parameters |
42 | export CLASS_ARGV |
43 | |
44 | run=run |
45 | valid_session=no |
46 | |
47 | # tell what we are |
48 | echo "Connected to $(print_version)" |
49 | |
50 | while [[ ${run} = run ]] |
51 | do |
52 | # use an echo here not read -p '>' because sslsvd ignores the prompt pattern |
53 | echo -n '> ' |
54 | read line |
55 | eval "GLOBAL_ARGV=( ${line} )" |
56 | |
57 | case ${GLOBAL_ARGV[0]} in |
58 | quit) run=quit ;; |
59 | |
60 | # only react on the globals -> import|get|set|auth |
61 | import) run_class ;; |
62 | control) run_class ;; |
63 | get) run_class ;; |
64 | set) run_class ;; |
65 | auth) validate_auth ${GLOBAL_ARGV[*]:1} ;; |
66 | certauth) validate_auth_certificate ${GLOBAL_ARGV[*]:1} ;; |
67 | register) valid_session && validate_client ${GLOBAL_ARGV[*]:1} ;; |
68 | provide) valid_session && print_provide ;; |
69 | require) valid_session && verify_requirements ;; |
70 | reload) valid_session && mecho "reloading client classes ..." && load_classes client ;; |
71 | restart) valid_session && restart_service ;; |
72 | stop) valid_session && stop_service ;; |
73 | nocolors) export NOCOLORS=1 ;; |
74 | colors) export NOCOLORS=0 ;; |
75 | webcrlf) export WEBCRLF=1 ;; |
76 | quiet) export QUIET=1 ;; |
77 | # version does not need auth |
78 | version) print_version ;; |
79 | help) |
80 | if valid_session |
81 | then |
82 | if [[ ${line} = help ]] |
83 | then |
84 | help_topics |
85 | else |
86 | run_class ${line} |
87 | fi |
88 | else |
89 | mecho "You must authenticate yourself first!" |
90 | mecho " auth [username] [password]" |
91 | mecho "or" |
92 | mecho " certauth [certificate fingerprint]" |
93 | fi |
94 | ;; |
95 | |
96 | *) |
97 | mecho "Unknown command '${line}'" |
98 | mecho "Type 'help' for more information." |
99 | #echo "$line" >> /root/lala.log |
100 | ;; |
101 | esac |
102 | |
103 | # unset argvs to be safe |
104 | unset GLOBAL_ARGS |
105 | unset CLASS_ARGS |
106 | done |
Properties
Name | Value |
---|---|
svn:executable | * |