mirror of
https://github.com/frappe/frappe_docker.git
synced 2025-01-26 16:48:25 +00:00
Update dbench
Added -s flag to dbench Former-commit-id: 2b1530e523ed0cc11d8ccd91a226764d344e63d0
This commit is contained in:
parent
51ded701ed
commit
41bc6d6164
13
dbench
13
dbench
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
display_usage() {
|
display_usage() {
|
||||||
echo "$(basename "$0") [-h] [-c \"<command to be executed inside container>\"]"
|
echo "$(basename "$0") [-h] [-c \"<command to be executed inside container>\"]"
|
||||||
@ -6,12 +6,13 @@ display_usage() {
|
|||||||
echo 'where:'
|
echo 'where:'
|
||||||
echo ' -h show this help text'
|
echo ' -h show this help text'
|
||||||
echo ' -c execute a command inside docker using docker exec'
|
echo ' -c execute a command inside docker using docker exec'
|
||||||
|
echo ' -s adds site-names to /etc/hosts file in the container to facilitate multisite access'
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
docker exec -it frappe bash
|
docker exec -it frappe bash
|
||||||
else
|
else
|
||||||
while getopts ':hc:' option; do
|
while getopts ':hsc:' option; do
|
||||||
case "$option" in
|
case "$option" in
|
||||||
h)
|
h)
|
||||||
display_usage
|
display_usage
|
||||||
@ -20,6 +21,14 @@ else
|
|||||||
c)
|
c)
|
||||||
docker exec frappe bash -c "bench $OPTARG"
|
docker exec frappe bash -c "bench $OPTARG"
|
||||||
;;
|
;;
|
||||||
|
s)
|
||||||
|
a=$(cd frappe-bench && ls sites/*/site_config.json | grep -o '/.\+/')
|
||||||
|
a="${a//$'\n'/ }"
|
||||||
|
a=$(echo $a | tr -d / )
|
||||||
|
result="127.0.0.1 ${a}"
|
||||||
|
echo $result
|
||||||
|
docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts"
|
||||||
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -$OPTARG" >&2
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user