Computing.Net > Forums > Unix > small script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

small script

Reply to Message Icon

Name: Devtakh
Date: June 8, 2004 at 16:05:18 Pacific
OS: hp-ux
CPU/Ram: 1280mb
Comment:

Hi,
I want to write a script or some kind of set up which will alert me when somebody other than me is loggin to the server with my login.say it shud send me out an email that from this ip address-somebody is using my loggin.and a possibility to warn them when they exceed the xx hrs of time.to log out.

Thanks for your help.

Regards,
Dev



Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: June 9, 2004 at 14:56:59 Pacific
Reply:

what makes you think this is "small"?

does "somebody other than me" mean there are more than 1 logins with your login?

what is your script writing experience?
what scripting languages?


0

Response Number 2
Name: LANkrypt0
Date: June 21, 2004 at 18:37:54 Pacific
Reply:

I dont know that I would even bother writing a script for this. The easiest way would be to edit your .login file. As an example and what you are looking for, mine looks like this:

last -1 username | mail -s "Logged in" email@address.com
bash
last -1 username | mail -s "Logged out" email@address.com

What this does is before my shell, bash, starts it reads the last login using last, and mails it to me. Then it runs bash, so the user will do what they are going to do. Then after they log out of bash and right before the connection is lost, the last command is run again to mail me that they have left the shell, logging out.


0

Response Number 3
Name: Jc
Date: July 9, 2004 at 01:45:06 Pacific
Reply:

#if test $REMOTEHOST = yourmachinename
if test $REMOTEHOST
then
echo "$REMOTEHOST logged in" > info.txt
Dt=`date`
mail -s "log info" name@place.com < info.txt
echo At $Dt : $REMOTEHOST logged in >>.logusers
else
REMOTEHOST=$HOSTNAME
echo -n Hai!!!
echo "Have A Good Day!!!"
fi


Jc


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: small script

Small Script www.computing.net/answers/unix/small-script/6996.html

Command Script www.computing.net/answers/unix/command-script/4337.html

Repeating script help www.computing.net/answers/unix/repeating-script-help/3280.html