#!/bin/bash FLAG_1=$1 FLAG_2=$2 FLAG_3=$3 R_PATH="$(pwd)" CURRENT_DATE=$(date +"%Y%m%d_%H%M%S") MUID="" OUPUT_PATH="" if [ -d "$R_PATH/output" ]; then OUPUT_PATH="output" elif [ -d "$R_PATH/outputs" ]; then OUPUT_PATH="outputs" elif [ -d "$R_PATH/SD/output" ]; then OUPUT_PATH="SD/output" elif [ -d "$R_PATH/SD/outputs" ]; then OUPUT_PATH="SD/outputs" else OUPUT_PATH="SD/output" fi if [ -f "$R_PATH/SD/MUID.txt" ]; then MUID=$(<./SD/MUID.txt) MUID=${MUID%%+( )} MUID=${MUID%%+(\n)} #MUID_LEN=${#MUID} #MUID=${MUID:1:MUID_LEN-2} else RANDOM_STR1="$(head -c 128 /dev/urandom | tr -dc 'A-Z')ZZ" RANDOM_STR2="$(head -c 384 /dev/urandom | tr -dc 'A-Z0-9')ZZZZZZZZZZZZZZ" MUID="${RANDOM_STR1::1}${RANDOM_STR2::14}${RANDOM_STR1:1:1}" echo -e "$MUID" >> ./SD/MUID.txt fi MUIDL="${MUID::3}${MUID:13:3}" if [[ "$FLAG_1" =~ h ]]; then echo -e " k : kill launch.sh(webui)\n @ : outputs/t2i folder to rename\n u : autoUpload MUID3+3\n f : forcePull\n o : out.sh\n g : gc.sh\n e : current chackpoint del\n d 0~9 : chackpoint download\n r : run.sh\n example : . e kdr 4" else if [[ "$FLAG_1" =~ k ]]; then kill -9 $(ps -ef | grep 'webui' | grep -v 'grep' | awk '{print $2}') kill -9 $(ps -ef | grep 'launch.py' | grep -v 'grep' | awk '{print $2}') kill -9 $(ps -ef | grep 'run.sh' | grep -v 'grep' | awk '{print $2}') fi if [[ "$FLAG_1" =~ @ ]]; then if [ -d "$R_PATH/$OUPUT_PATH/txt2img-images" ]; then RANDOM_STR="$(head -c 128 /dev/urandom | tr -dc 'A-Z')ZZZ" RENAME_NAME="t2i_${RANDOM_STR::4}${CURRENT_DATE}" \mv -f "$R_PATH/$OUPUT_PATH/txt2img-images" "$R_PATH/$OUPUT_PATH/${RENAME_NAME}" echo -e "rename txt2img-images -> ${RENAME_NAME}" fi fi if [[ "$FLAG_1" =~ u ]]; then curl -L -O https://huggingface.co/zuv0/SDXLF17/resolve/main/autoUpload.sh sleep 1 bash -c ". ./autoUpload.sh $MUIDL" fi if [[ "$FLAG_1" =~ f ]]; then bash -c ". $R_PATH/forcePull.sh" fi if [[ "$FLAG_1" =~ o ]]; then bash -c ". $R_PATH/out.sh" fi if [[ "$FLAG_1" =~ g ]]; then bash -c ". $R_PATH/gc.sh" fi if [[ "$FLAG_1" =~ e ]]; then bash -c ". $R_PATH/SD/downs.sh gc" fi if [[ "$FLAG_1" =~ d ]]; then bash -c ". $R_PATH/SD/downs.sh $FLAG_2 0" fi if [[ "$FLAG_1" =~ r ]]; then bash -c ". $R_PATH/run.sh" fi fi