5 # Bring up a new batch stack. We overwrite the -max_stacks flag: by default it
6 # is 5. This way, we can always bring up a batch stack, even if there are 5
7 # batch queries running currently.
8 STACK
=$
(dcs-batch-helper
-max_stacks=6 create
)
11 echo "Could not create a new batch stack" >&2
15 # Now point the source-backend to /dcs/unpacked-new instead of /dcs/unpacked.
16 EXECSTART
=$
(perl
-nlE 'say if /^ExecStart=.*[^\\]$/ || /^ExecStart=/ .. /[^\\]$/' < /run
/systemd
/system
/dcs-batch
${STACK}-source-backend.service |
sed 's,/dcs/unpacked,/dcs/unpacked-new,g')
18 mkdir
/run
/systemd
/system
/dcs-batch
${STACK}-source-backend.service.d
19 cat >/run
/systemd
/system
/dcs-batch
${STACK}-source-backend.service.d
/args.conf
<<EOT
25 systemctl daemon-reload
26 systemctl restart dcs-batch
${STACK}-source-backend.service
28 # And point the index-backends to /dcs/NEW/*.idx instead of /dcs/*.idx
29 EXECSTART
=$
(perl
-nlE 'say if /^ExecStart=.*[^\\]$/ || /^ExecStart=/ .. /[^\\]$/' < /run
/systemd
/system
/dcs-batch
${STACK}-index-backend@.service |
sed 's,/dcs/index,/dcs/NEW/index,g')
30 for backend
in $
(systemctl list-units
--full |
grep "^dcs-batch${STACK}-index-backend" | cut
-f 1 -d ' ')
32 mkdir
/run
/systemd
/system
/${backend}.d
33 cat >/run
/systemd
/system
/${backend}.d
/args.conf
<<EOT
38 systemctl daemon-reload
39 systemctl restart
$backend
42 # TODO: remove this once dcs-web is socket-activated.
45 # Verify the new files are okay.
46 # As we discover problems, more checks could be added here, but this one seems fine for now.
47 if ! wget
-qO- "http://localhost:30${STACK}20/search?q=i3Font" |
grep -q 'i3Font load_font'
49 echo "Stack not serving correctly, /search?q=i3Font did not contain 'i3Font load_font'" >&2
53 # Delete the drop-ins and destroy the batch stack.
54 rm -rf /run
/systemd
/system
/dcs-batch
${STACK}-source-backend.service.d
55 for backend
in $
(systemctl list-units
--full |
grep "^dcs-batch${STACK}-index-backend" | cut
-f 1 -d ' ')
57 rm -rf /run
/systemd
/system
/${backend}.d
60 dcs-batch-helper destroy
$STACK