Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Linux script help

Posted by: Greyfang Nov 25 2007, 06:40 PM

I'm working on a Linux script, and yes, it's a homework assignment. I'm writing a script which will automatically email the admin a list of login attempts, both good and bad, on a daily basis. I have written the script, but I don't have a Linux computer on which to test the script, and would just like to know if I've forgotten any details, and since my Linux experience is very limited, I'm sure I have. I'm not looking for a walkthrough here, just let me know if there's something more I need to look at to make this a workable script, please smile.gif

#!/bin/bash

#This will need to be changed to whatever email address is required
NOTIFY_ADDRESS=admin@localhost

0 4 * * * /var/spool/cron/myscript

tmp=$(mktemp)

last > "$tmp"

lastb >> "$tmp"

mail -s "daily login report" date "$tmp" | NOTIFY_ADDRESS

rm -f "$tmp"

%

That's it. Any help would be much appreciated. Thanks in advance for your assistance.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)