Files
huike-back/scripts/moicen_enqueue_image_form_compress_manual.sh
T

37 lines
986 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 在 moicen 上插入一条 IMAGE_FORM_COMPRESSPENDING+ Redis payload,供 htyproc 拉取验收。
# 用法(moicen:
# export PGPASSWORD=postgres
# bash moicen_enqueue_image_form_compress_manual.sh
set -euo pipefail
TASK_ID="$(uuidgen | tr '[:upper:]' '[:lower:]')"
PUBLIC_URL="${PUBLIC_URL_OVERRIDE:-https://upyun.moicen.com/music-room/e2e-manual-${TASK_ID}.jpg}"
export PGPASSWORD="${PGPASSWORD:-postgres}"
psql -h localhost -U postgres -d htytask_moicen -v ON_ERROR_STOP=1 <<SQL
INSERT INTO public.dbtask (
task_id, hty_id, task_type, task_status, duration,
created_by, created_at, updated_by, updated_at, meta
) VALUES (
'${TASK_ID}',
NULL,
'IMAGE_FORM_COMPRESS',
'PENDING',
NULL,
'e2e-manual',
NOW(),
'e2e-manual',
NOW(),
NULL
);
SQL
PAYLOAD=$(printf '{"url":"%s"}' "$PUBLIC_URL")
redis-cli SET "TS_${TASK_ID}" "$PAYLOAD" >/dev/null
echo "task_id=${TASK_ID}"
echo "redis_key=TS_${TASK_ID}"
echo "payload=${PAYLOAD}"