The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > OS X (Apple)
.
google unix.com



OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Automating slapconfig ZevEisenberg Shell Programming and Scripting 0 11-14-2008 02:10 PM
email sarg URL report link paulds UNIX for Dummies Questions & Answers 0 07-18-2008 12:59 PM
Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win) Vetrivela UNIX for Advanced & Expert Users 2 02-15-2005 10:43 AM
automating password ? Liamo Shell Programming and Scripting 3 05-24-2004 06:01 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-24-2009
glev2005 glev2005 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 74
Automating Email SUS report

I have a script that I run through ARD to report on how many patches are required by Software Update on each client. It is a vertical list of comprised of computername <number or required updates> . How can Iautomate this easily to have it mailed to a group of people every Monday morning using Entourage 2008 as my email client. Thanks so much!
  #2 (permalink)  
Old 04-21-2009
mlott mlott is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 1
Hi

This is a starting point I guess, so I hope it is of some help. Not sure why you want to use Entourage specifically when you can use the "mail" program that comes pre-compiled in OS X, but hey, whatever you need.

Firstly you'll need to get the list somewhere on the filesystem. In this example script it is in a file called sus_list.txt under the /tmp/ directory.


Code:
!/bin/sh

#============================
# Define admin email address
NOTIFY="one@you.com, two@you.com"

# Get computer name
C_NAME=`/usr/sbin/scutil --get ComputerName`

# Define a function
mailOUT ()
{
        echo From: ${C_NAME} - Monday Morning ARD SUS Notification \
        > /tmp/sus_mailout.txt
        echo ----- >> /tmp/sus_mailout.txt
        echo Timestamp: `date` >> /tmp/sus_mailout.txt
        echo ----- >> /tmp/sus_mailout.txt
        echo "Please find below the list of clients that need patching" \
        >> /tmp/sus_mailout.txt
	echo ----- >> /tmp/sus_mailout.txt
	echo "" >> /tmp/sus_mailout.txt
	cat /tmp/sus_list.txt >> /tmp/sus_mailout.txt
        cat /tmp/sus_mailout.txt | mail -s "From: ${C_NAME} - Monday \
        Morning ARD SUS Notification" ${NOTIFY}
}

if [ -f /tmp/sus_list.txt ]
then
	mailOUT
else
	# log error to the syslog
	logger "SUS: File /tmp/sus_list.txt does not exist"
fi
exit 0
This script will have to be made executable or called like this

Code:
sh /path/to/script
I usually place scripts like this in /usr/local/scripts/ but that is a personal preference.

Normally I'd say to use Launchd to handle the scheduling of the script, but the StartCalendarInterval is not tuned enough for this at present, so it's back to good old cron. Personally, I wouldn't have this run by the root account as there is nothing in there that requires root privileges. To that end, in your crontab, add the following so that it will run at 0900 every Monday:

Code:
0 9 * * 1 /usr/local/scripts/mailout.sh
HTH a bit,

Mike
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0