mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
Retry so-user commands if another process is currently using so-user
This commit is contained in:
@@ -56,6 +56,9 @@ function manage_user() {
|
||||
request=$1
|
||||
op=$(echo "$request" | jq -r .operation)
|
||||
|
||||
max_tries=10
|
||||
tries=0
|
||||
while [[ $tries -lt $max_tries ]]; do
|
||||
case "$op" in
|
||||
add)
|
||||
email=$(echo "$request" | jq -r .email)
|
||||
@@ -108,6 +111,15 @@ function manage_user() {
|
||||
;;
|
||||
esac
|
||||
|
||||
tries=$((tries+1))
|
||||
if [[ "$response" == "Another process is using so-user"* ]]; then
|
||||
log "Retrying after brief delay to let so-user unlock ($tries/$max_tries)"
|
||||
sleep 5
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ exit_code -eq 0 ]]; then
|
||||
log "Successful command execution: $response"
|
||||
$(echo "true" > "${SOC_PIPE}")
|
||||
|
||||
Reference in New Issue
Block a user