- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script needs some modification
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2011 11:26 PM
тАО01-30-2011 11:26 PM
Script needs some modification
Attached is a script that i have created for account lock notification to users.
The script works fine, but it sends an empty mail even if the account is not locked.
My requirement:
Mail notification should come only if an account is locked but not otherwise.
Please have a look at the script and provide a solution for this.
Thanks in Advance!
Sridhar
- Tags:
- passwd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2011 11:33 PM
тАО01-30-2011 11:33 PM
Re: Script needs some modification
Edit your mailer section as follows:
if [ -s /tmp/lockout.txt ]
then
cat /tmp/lockout.txt | \
mailx -s " USER ACCOUNT STATUS NOTIFICATION " \
unixoraclealerts@mindscapeit.com datacenter@mindscapeit.com plasbof@mindscapeit.com mathewsk@mindscapeit.com utpals@mindscapeit.com padmanabanm@mindscapeit.com
fi
rm /tmp/lockout.txt
This will check to make sure the lockout.txt exists and has a size larger than zero bytes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2011 11:39 PM
тАО01-30-2011 11:39 PM
Re: Script needs some modification
Richard solved it with that "-s" test on the file.
You should also remove lockout.txt at the start so you don't accumulate messages.
You can also eliminate that evil cat by:
mailx -s "USER ACCOUNT STATUS NOTIFICATION" \
address ... < /tmp/lockout.txt
- Tags:
- evil cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2011 03:23 AM
тАО01-31-2011 03:23 AM
Re: Script needs some modification
Thanks for the reply.
I am not getting blank mails now. But i am not getting account lock notification either.
Mails are queued up ans is showing up in mailq output.
Kindly help!
Thanks,
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2011 05:56 AM
тАО01-31-2011 05:56 AM
Re: Script needs some modification
> I am not getting blank mails now. But i am not getting account lock notification either.
Posting your *modified* script would help diagnose your current problem.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2011 06:19 AM
тАО01-31-2011 06:19 AM
Re: Script needs some modification
When you run the 'mailq' command what is the reason show for the mail being queued?
It sounds as if sendmail isn't sending mail for some reason.
Run: /usr/sbin/sendmail -q
to try to empty the mail queue.
Also check /var/adm/syslog/mail.log and look for any error messages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2011 10:33 AM
тАО01-31-2011 10:33 AM
Re: Script needs some modification
Hmm. If you were getting mail before, the changes shouldn't have stopped mail completely.
Can you invoke mailx manually to try to send mail? Any other configuration changes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2011 06:10 PM
тАО02-01-2011 06:10 PM
Re: Script needs some modification
mail.log will have the status of each email. Rather than use your script, test outgoing mail manually like this:
sendmail -v name@myserver.com < /etc/hosts
Then type: mtail
(which is the same as tail /var...mail.log) The error for this message will be shown.
Bill Hassell, sysadmin