refactor(worker): Replace basic commands with bench

This commit is contained in:
Lev
2021-11-08 16:10:26 +03:00
parent 9d41a6d24e
commit e4df6e5aec
6 changed files with 28 additions and 143 deletions

View File

@@ -102,17 +102,16 @@ case "$1" in
worker)
checkConfigExists
checkConnection
# default WORKER_TYPE=default
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/worker.py
: "${WORKER_TYPE:=default}"
bench worker --queue $WORKER_TYPE
;;
schedule)
checkConfigExists
checkConnection
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/background.py
bench schedule
;;
new)
@@ -127,8 +126,24 @@ case "$1" in
checkConfigExists
checkConnection
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/drop.py
exit
: "${SITE_NAME:=site1.localhost}"
: "${DB_ROOT_USER:=root}"
: "${DB_ROOT_PASSWORD:=$POSTGRES_PASSWORD}"
: "${DB_ROOT_PASSWORD:=$MYSQL_ROOT_PASSWORD}"
: "${DB_ROOT_PASSWORD:=admin}"
if [[ -n $NO_BACKUP ]]; then
NO_BACKUP=--no-backup
fi
if [[ -n $FORCE ]]; then
FORCE=--force
fi
bench drop-site \
$SITE_NAME \
--root-login $DB_ROOT_USER \
--root-password $DB_ROOT_PASSWORD \
--archived-sites-path /home/frappe/frappe-bench/sites/archive_sites \
$NO_BACKUP $FORCE
;;
migrate)
@@ -142,9 +157,13 @@ case "$1" in
;;
backup)
if [[ -n $WITH_FILES ]]; then
WITH_FILES=--with-files
fi
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/backup.py
exit
for site in ${$SITES//:/ }; do
bench --site $site backup $WITH_FILES
done
;;
console)
@@ -154,8 +173,7 @@ case "$1" in
exit 1
fi
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/console.py "$2"
exit
bench --site "$2" console
;;
push-backup)