Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2466 - (show annotations) (download)
Tue Sep 8 08:24:07 2015 UTC (8 years, 7 months ago) by niro
File size: 2658 byte(s)
-moved control_client() to control.global.class
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 #IP="192.168.0.6"
32 PORT="6666"
33 SSLSAY_USER="foo"
34 SSLSAY_PASS="bar"
35
36 DEBUG=1
37 NOCOLORS="false"
38 WEBCRLF="false"
39 QUIET="false"
40
41 # argvs are global variables - this fixes issues with whitespaces
42 # global argvs, the whole command line
43 export GLOBAL_ARGV
44 # class specific argvs which are given to the class as parameters
45 export CLASS_ARGV
46
47 run=run
48 valid_session=no
49
50 # tell what we are
51 echo "Connected to $(print_version)"
52
53 while [[ ${run} = run ]]
54 do
55 # use an echo here not read -p '>' because sslsvd ignores the prompt pattern
56 echo -n '> '
57 read line
58 eval "GLOBAL_ARGV=( ${line} )"
59
60 case ${GLOBAL_ARGV[0]} in
61 quit) run=quit ;;
62
63 # only react on the globals -> import|get|set|auth
64 import) run_class ;;
65 control) run_class ;;
66 get) run_class ;;
67 set) run_class ;;
68 auth) validate_auth ${GLOBAL_ARGV[*]:1} ;;
69 certauth) validate_auth_certificate ${GLOBAL_ARGV[*]:1} ;;
70 register) valid_session && validate_client ${GLOBAL_ARGV[*]:1} ;;
71 provide) valid_session && print_provide ;;
72 require) valid_session && verify_requirements ;;
73 reload) valid_session && mecho "reloading client classes ..." && load_classes client ;;
74 restart) valid_session && restart_service ;;
75 stop) valid_session && stop_service ;;
76 nocolors) export NOCOLORS="true" ;;
77 colors) export NOCOLORS="false" ;;
78 webcrlf) export WEBCRLF="true" ;;
79 quiet) export QUIET="true" ;;
80 # version does not need auth
81 version) print_version ;;
82 help)
83 if valid_session
84 then
85 if [[ ${line} = help ]]
86 then
87 help_topics
88 else
89 run_class ${line}
90 fi
91 else
92 mecho "You must authenticate yourself first!"
93 mecho " auth [username] [password]"
94 mecho "or"
95 mecho " certauth [certificate fingerprint]"
96 fi
97 ;;
98
99 *)
100 mecho "Unknown command '${line}'"
101 mecho "Type 'help' for more information."
102 #echo "$line" >> /root/lala.log
103 ;;
104 esac
105
106 # unset argvs to be safe
107 unset GLOBAL_ARGS
108 unset CLASS_ARGS
109 done

Properties

Name Value
svn:executable *