mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +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
|
request=$1
|
||||||
op=$(echo "$request" | jq -r .operation)
|
op=$(echo "$request" | jq -r .operation)
|
||||||
|
|
||||||
|
max_tries=10
|
||||||
|
tries=0
|
||||||
|
while [[ $tries -lt $max_tries ]]; do
|
||||||
case "$op" in
|
case "$op" in
|
||||||
add)
|
add)
|
||||||
email=$(echo "$request" | jq -r .email)
|
email=$(echo "$request" | jq -r .email)
|
||||||
@@ -108,6 +111,15 @@ function manage_user() {
|
|||||||
;;
|
;;
|
||||||
esac
|
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
|
if [[ exit_code -eq 0 ]]; then
|
||||||
log "Successful command execution: $response"
|
log "Successful command execution: $response"
|
||||||
$(echo "true" > "${SOC_PIPE}")
|
$(echo "true" > "${SOC_PIPE}")
|
||||||
|
|||||||
Reference in New Issue
Block a user