Skip to content

Commit

Permalink
[fix]: signal
Browse files Browse the repository at this point in the history
  • Loading branch information
Neprincessa committed Jun 11, 2020
1 parent 9b8df42 commit a732c1c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sources/service/ssh-monitoring.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/bin/bash

source ssh-monitoring-lib.sh
source monitor_ssh_lib.sh

logger "SSH service started"

PREV_USER=$(ps -eo command | grep "^sshd:.*@.*$" | awk -F'[ @]' '{print $2}')

sleep 50
PREV_USER=$(ps -eo command | grep "^sshd:.*@.*$" | awk -F'[ @]' '{print $2}')

trap "logger SSH service catched USR1 signal; exit 0" SIGUSR1

while true
do

NEW_USER=$(ps -eo command | grep "^sshd:.*@.*$" | awk -F'[ @]' '{print $2}')
TMP=$(check_ssh_users "$PREV_USER" "$NEW_USER")
if [ -n "$TMP" ]
Expand All @@ -21,5 +20,8 @@ do
echo "$TMP successfully login" | wall
echo "$TMP successfully login"
fi
sleep 30

sleep 30 &
wait
done

0 comments on commit a732c1c

Please sign in to comment.