Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
mxq
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
3
Code
Issues
20
Pull requests
3
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
0be33f7
helper
manpages
mysql
web
.gitignore
.vimrc
Doxyfile
LICENSE
Makefile
README.md
keywordset.c
keywordset.h
mx_flock.c
mx_flock.h
mx_getopt.c
mx_getopt.h
mx_log.c
mx_log.h
mx_mysql.c
mx_mysql.h
mx_proc.c
mx_proc.h
mx_util.c
mx_util.h
mxq.h
mxq_daemon.c
mxq_daemon.h
mxq_group.c
mxq_group.h
mxq_job.c
mxq_job.h
mxq_log.c
mxqadmin.c
mxqd.c
mxqd.h
mxqd_control.c
mxqd_control.h
mxqdctl-hostconfig.sh
mxqdump.c
mxqkill.c
mxqps.c
mxqset.c
mxqsub.c
os-release
parser.y
ppidcache.c
ppidcache.h
test_keywordset.c
test_mx_log.c
test_mx_mysql.c
test_mx_util.c
test_mxqd_control.c
test_parser.c
xmalloc.h
Breadcrumbs
mxq
/
mxqdctl-hostconfig.sh
Blame
Blame
Latest commit
History
History
executable file
·
160 lines (139 loc) · 4 KB
Breadcrumbs
mxq
/
mxqdctl-hostconfig.sh
Top
File metadata and controls
Code
Blame
executable file
·
160 lines (139 loc) · 4 KB
Raw
#!/bin/bash hostconfig=/etc/hostconfig shorthost=${HOSTNAME%.molgen.mpg.de} declare -i started=0 mxqd=mxqd defaultargs=(--daemonize) pidfilebase=/dev/shm/mxqdctl-hostconfig shopt -s nullglob function start_all_hostconfig() { while read -a line ; do host=${line[0]} var=${line[1]} unset 'line[0]' unset 'line[1]' if [ "${var}" != "mxqd" ] ; then continue fi if [ "${host}" != "${shorthost}" ] ; then continue fi args=(${defaultargs[@]} --pid-file "${pidfilebase}${started}.pid" ${line[@]}) echo "executing ${mxqd} ${args[@]}" ${mxqd} ${args[@]} started+=1 done < ${hostconfig} if [ ${started} -lt 1 ] ; then echo >&2 "host '${shorthost}' is not configured for mxqd in '${hostconfig}'." exit 1 fi } function stop_all_started() { for pidfile in ${pidfilebase}* ; do ouid=$(stat --format "%u" "${pidfile}") if [ "${UID}" != "${ouid}" ] ; then continue fi pid=$(cat ${pidfile}) echo "${pidfile}: killing ${pid}" kill ${pid} done } function quit_all_started() { for pidfile in ${pidfilebase}* ; do ouid=$(stat --format "%u" "${pidfile}") if [ "${UID}" != "${ouid}" ] ; then continue fi pid=$(cat ${pidfile}) echo "${pidfile}: sending signal SIGQUIT to ${pid}" kill -QUIT ${pid} done } function reload_all_started() { for pidfile in ${pidfilebase}* ; do ouid=$(stat --format "%u" "${pidfile}") if [ "${UID}" != "${ouid}" ] ; then continue fi pid=$(cat ${pidfile}) echo "${pidfile}: sending signal SIGUSR1 to restart pid ${pid}" kill -USR1 ${pid} done } function kill_all_started() { for pidfile in ${pidfilebase}* ; do ouid=$(stat --format "%u" "${pidfile}") if [ "${UID}" != "${ouid}" ] ; then continue fi pid=$(cat ${pidfile}) echo "${pidfile}: sending signal SIGINT to kill pid ${pid} and all running jobs" kill -INT ${pid} done } case "${BASH_ARGV[0]}" in start) start_all_hostconfig ;; stop) stop_all_started ;; kill) kill_all_started ;; quit) quit_all_started ;; reload|restart) reload_all_started ;; stopall) env kill mxqd ;; killall) env kill -int mxqd ;; quitall) env kill -quit mxqd ;; reloadall|restartall) env kill -usr1 mxqd ;; stateall) env kill -usr2 -q 10 mxqd ;; setinfoall|setnodebugall) env kill -usr2 -q 20 mxqd ;; setdebugall) env kill -usr2 -q 21 mxqd ;; *) echo "usage $0 CMD" echo "" echo "to mxqd configured by hostconfig:" echo "" echo " start : start mxqd (if configured by hostconfig)" echo " stop : tell mxqd to stop accepting new jobs, wait for running jobs, exit" echo " kill : tell mxqd to stop accepting new jobs, kill and wait for running jobs, exit" echo " quit : tell mxqd to exit (leave jobs running)" echo " reload|restart : tell mxqd to re-exec itself, leave jobs running" echo "" echo "to all mxqd owned by calling user:" echo "" echo " stopall : tell mxqd to stop accepting new jobs, wait for running jobs, exit" echo " killall : tell mxqd to stop accepting new jobs, kill and wait for running jobs, exit" echo " quitall : tell mxqd to exit (leave jobs running)" echo " reloadall|restartall : tell mxqd to re-exec itself, leave jobs running" echo "" echo " stateall : tell mxqd to dump state" echo " setdebugall : tell to set loglevel to debug" echo " setinfoall|setnodebugall : tell mxqd to set loglevel to info" ;; esac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
You can’t perform that action at this time.