Powiadomienia
Wyczyść wszystko
BugOverflow
1
Wpisy
1
Użytkownicy
0
Reactions
879
Widoki
0
16/03/2021 11:22 am
Rozpoczynający temat
example script, shell
1 odpowiedź
0
16/03/2021 11:23 am
Rozpoczynający temat
#!/bin/sh #432000 5 days time_to_expire=0 current_timestamp=$(date +%s) user_timestamp=0 notify_threshold=432000 for user in $(cat /etc/passwd | cut -d : -f 1) do user_timestamp=$(pw showuser -n $user | cut -d: -f 6) time_to_expire=$(($user_timestamp-$current_timestamp)) echo $user echo $time_to_expire if [ $time_to_expire -gt 0 ] && [ $time_to_expire -lt $notify_threshold ]; then $(echo "Your password will expire, change it" | mail -s "Mail password expiration" $user@my.target.user.com) fi done | paste -d " " - -