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