Enhanced output with new features of sequencer

This commit is contained in:
2022-02-15 14:01:52 +01:00
parent dcdb6b45a3
commit 653d233586
6 changed files with 69 additions and 33 deletions

View File

@@ -182,7 +182,10 @@ step_12() {
exe service ${toolServiceName} restart
}
step_14_info() { echo "Show $toolName version running at [IP]:8008"; }
step_14_info() {
echoinfoArgs "[IP]:8008"
echo "Show $toolName version"
}
step_14_alias() { ALIAS="version"; }
step_14() {
local synapseIP=localhost
@@ -196,8 +199,9 @@ step_14() {
exep "curl -sS \"$apiCall\" | python -m json.tool | grep _version"
}
step_16_info() {
echo "List all registered users [OPTION] [IP]:8008"
step_16_info() {
echoinfoArgs "[OPTION] [IP]:8008"
echo "List all registered users"
echoinfo "[OPTION]"
echoinfo " -r : Raw json output"
}
@@ -238,12 +242,9 @@ step_18() {
step_20_info() {
shift
echoinfoArgs "[USER NAME]"
echo -n "Reset user password"
if [ -z $1 ]; then
echo " [USER NAME]"
else
echo " for $1"
fi
[ $CONTEXT_EXE -ne 0 ] && echoinfo " for $1" || echo
}
step_20_alias() { ALIAS="resetpw"; }
step_20() {
@@ -268,7 +269,8 @@ step_20() {
}
step_22_info() {
echo "List all rooms [OPTION] [IP]:8008"
echoinfoArgs "[OPTION] [IP]:8008"
echo "List all rooms"
echoinfo "[OPTION]"
echoinfo " -r : Raw json output"
}
@@ -303,7 +305,8 @@ step_22() {
}
step_24_info() {
echo "List all room members [OPTION] [ROOM ID] [IP]:8008"
echoinfoArgs "[OPTION] [ROOM ID] [IP]:8008"
echo "List all room members"
echoinfo "[OPTION]"
echoinfo " -r : Raw json output"
}
@@ -342,7 +345,11 @@ step_24() {
exep "curl -sS --header \"Authorization: Bearer $MATRIX_ACCESS\" \"$apiCall\" | python -m json.tool $grepOut"
}
step_26_info() { echo "Delete rooms without local users [IP]:8008"; }
step_26_info() {
echoinfoArgs "[IP]:8008"
echo "Delete rooms without local users"
echoinfo " [IP] : default is localhost"
}
step_26_alias() { ALIAS="purge"; }
step_26() {
adminTokenCheck
@@ -371,7 +378,8 @@ step_26() {
step_28_info() {
echo "Delete room [OPTION] <ROOM ID> [IP]:8008"
echoinfoArgs "<ROOM ID> [IP]:8008"
echo "Delete room"
}
step_28_alias() { ALIAS="deleteroom"; }
step_28() {
@@ -418,7 +426,7 @@ postDataDeleteRoom()
EOF
}
step_30_info() { echo "Debloat postgres [DATABASE]"; echo; }
step_30_info() { echoinfoArgs "[DATABASE]"; echo "Debloat postgres"; echo; }
step_30_alias() { ALIAS="debloat"; }
step_30() {
shift

View File

@@ -120,7 +120,8 @@ save \"\"
databases 2"
step_10_info() {
echo "Upgrade $toolName to $toolVersion [OPTIONS]"
echoinfoArgs "[OPTIONS]"
echo "Upgrade $toolName to $toolVersion"
echoinfo " [OPTIONS]"
echoinfo " super : update also supervisor configuration"
echoinfo " (manual redis password update may be needed)"

View File

@@ -4,6 +4,7 @@
# - mysql.sh (soft; Missing informational output)
toolName="nextcloud"
localOcc=("echo" "occ not found!")
# Get script working directory
# (when called from a different directory)
@@ -18,6 +19,7 @@ step_config() {
if [ $? -eq 0 ] ; then
CONFIG=1
fi
localOcc=( sudo -u www-data php "$(escpath "$NC_INSTALL_DIR/occ")" )
}
step_20_info() { echo "Upgrade $toolName on command line to latest version of selected release channel"; }
@@ -32,10 +34,21 @@ step_20() {
}
ncInstaller="updater/updater.phar"
step_100_info() { echoinfoArgs "<NC DATABASE> <IPV4 ADDRESS>"; echo "Delete IP from bruteforce table"; }
step_100_alias() { ALIAS="bruteforceRemoveIP"; }
step_100_info() {
echoinfoArgs "[OCC ARGS]"
echo "Execute occ command"
}
step_100_alias() { ALIAS="occ"; }
step_100() {
shift
exe "${localOcc[@]}" "$@"
}
step_102_info() { echoinfoArgs "<NC DATABASE> <IPV4 ADDRESS>"; echo "Delete IP from bruteforce table"; }
step_102_alias() { ALIAS="bruteforceRemoveIP"; }
step_102() {
shift
local ncdb=
local ip=
local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}$'
@@ -62,33 +75,44 @@ step_100() {
endReturn -o $? "Error deleting ip $ip"
}
step_102_info() { echoinfoArgs "<USER>"; echo "Reset and rescan the music library in the background for one user"; }
step_102_alias() { ALIAS="audioreset"; }
step_102() {
step_104_info() { echoinfoArgs "<USER>"; echo "Reset and rescan the music library in the background for one user"; }
step_104_alias() { ALIAS="audioreset"; }
step_104() {
shift
local ncUser=$1
local lOcc="sudo -u www-data php $NC_INSTALL_DIR/occ"
if [ -z "$ncUser" ] ; then
echoerr " [E] Reset only for single user"
return 1
fi
exep "sudo -u www-data php \"$NC_INSTALL_DIR/occ\" audioplayer:reset $ncUser > /var/log/ncAudioRescan.log"
exep "${localOcc[@]} audioplayer:reset $ncUser > /var/log/ncAudioRescan.log"
echoseq " [I] Rescan audioplayer database for user $ncUser"
exep "sudo -u www-data php \"$NC_INSTALL_DIR/occ\" audioplayer:scan -vvvv $ncUser >> /var/log/ncAudioRescan.log &"
exep "${localOcc[@]} audioplayer:scan -vvvv $ncUser >> /var/log/ncAudioRescan.log &"
}
step_104_info() { echo "Reset picture preview folder"; }
step_104_alias() { ALIAS="resetpreview"; }
step_104() {
local lOcc="sudo -u www-data php \"$NC_INSTALL_DIR/occ\""
step_106_info() { echoinfoArgs "<USER>"; echo "Scan the music library"; }
step_106_alias() { ALIAS="audioscan"; }
step_106() {
shift
local ncUser=$1
if [ -z "$ncUser" ] ; then
echoerr " [E] Reset only for single user"
return 1
fi
exe "${localOcc[@]}" audioplayer:scan -vvvv $ncUser
}
step_110_info() { echo "Reset picture preview folder"; }
step_110_alias() { ALIAS="resetpreview"; }
step_110() {
if [ -e "${NC_DATA_DIR}" ]; then
exe rm -rf "${NC_DATA_DIR}/appdata_"*"/preview/"*
echoseq " [I] Rescan app data folder"
exep "$lOcc files:scan-app-data &"
exep "${localOcc[@]} files:scan-app-data &"
else
echoerr " [E] Nextcloud data direcotry $NC_DATA_DIR not found"
return 1
@@ -113,5 +137,5 @@ occ config:app:set preview jpeg_quality --value="60"
NOTES_END
}
VERSION_SEQREV=14
VERSION_SEQREV=15
. /usr/local/bin/sequencer.sh

View File

@@ -95,9 +95,9 @@ step_4() {
}
step_5_info() {
echoinfoArgs "<SECRET>"
echoinfoArgs "[SECRET]"
echo "Install/start onlyoffice docker container"
echoinfo "If <SECRET> is empty, user input will be available if not run --quiet."
echoinfo "If [SECRET] is empty, user input will be available if not run --quiet."
echoinfo "$toolName will be run unsecured if no secret was provied."
}
step_5_alias() { ALIAS="startoo"; }

View File

@@ -30,7 +30,7 @@ step_config() {
# # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1
#fi
#[ $QUIET -ne 0 ] && APTOPT="-y"
[ $QUIET -ne 0 ] && APTOPT="-y"
return 0
}

View File

@@ -30,7 +30,10 @@ step_30() {
exep "cd \"${PIWI_DIR}\"/.. && tar czf \"${PIWI_BU_DIR}/\`date +%Y%m%d\`_${toolName}_web.tar.gz\" --exclude=\"${toolName}/network/*\" --exclude=\"${toolName}/_data/i/*\" \"$(basename "$PIWI_DIR")\""
}
step_31_info() { echo "Backup ${toolName} database [daily|monthly(default)]"; }
step_31_info() {
echoinfoArgs "[daily|monthly(default]"
echo "Backup ${toolName} database"
}
step_31_alias() { ALIAS="backupdb"; }
step_31() {
case "$2" in
@@ -45,5 +48,5 @@ step_31() {
esac
}
VERSION_SEQREV=12
VERSION_SEQREV=14
. /usr/local/bin/sequencer.sh