This is a discussion on shell script to send mail for each login. within the Shell scripting forums, part of the Development/Scripting category; Hi Everybody, Recently i wrote a script to send mail for each login to my server, as i wanted to ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Hi Everybody,
Recently i wrote a script to send mail for each login to my server, as i wanted to send mail at the moment of every login i put this script to /root/.bashrc and it is sending mail only for root logins.now,the problem raisen that i couldn't use scp with this servers. i don't know is the script correct or not.Please help me to find out the cause of the problem....or any other script to make it work effectively.....Please help... &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&& #!/bin/bash echo `last $i | head -1 | awk '{print $1" "$3" "$4" "$5" "$6" "$7}'`|while read output; do echo $output ip=$(echo $output | awk '{print $2}' ) on=$(echo $output | awk '{print $3" "$4" "$5}' ) at=$(echo $output | awk '{print $6'} ) echo "User logged in to $(hostname) server from $ip on $on at $at"|mail -s "Alert from server $(hostname)" xxxx@example.com done &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&& Thanks in advance., Ephdia |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to monitor a particular directory and send out e-mail.... | nageshms | Shell scripting | 1 | 02-11-2008 02:01 PM |
| shell scripting + send mail with header | ephdia | Shell scripting | 0 | 11-27-2007 11:29 AM |
| send mail installation and configuration | jhn_daz@yahoo.com | Mail Servers | 1 | 11-01-2007 09:37 AM |
| send mail attachment solaris | K.R. | Solaris/OpenSolaris | 1 | 02-01-2007 07:05 PM |
| Require Shell Script Which sends all server info on mail | puppen | Linux software | 3 | 10-25-2006 08:07 PM |