Editing
How to get the NAS to email you everytime someone logs into the CLI
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===login.sh script=== Below is the /volume1/my_scripts/login.sh script. This script assumes you use nail as your email client. You will need to modify it if you dont. You will also need to set your email address appropriately <pre> #!/bin/sh #This sub routine sends an email to say someone just logged in to the Command Line Interface # To turn echo off so the logged in user doesn't know the script is running # redirect stdout(1) and stderr(2) to null: exec 1>/dev/null 2>/dev/null #set the subject of the email var_subject="NAS1 - A user has logged in to the CLI" #send the email echo "NAS1 - A user has logged in to the CLI" | /opt/bin/nail -s "$var_subject" you@youremail.com #if the email fails nail will create a file dead.letter, test to see if it exists and if so wait 1minute and then resend while ls "/root/dead.letter" do # echo email failed - waiting 1 minute and then re-sending sleep 60 rm "/root/dead.letter" echo "CubeStation1 - A user has logged in to the CLI" | /opt/bin/nail -s "$var_subject" you@youremail.com sleep 60 done sleep 60 exit </pre>
Summary:
Please note that all contributions to wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information