Automating Email SUS report

 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Automating Email SUS report
# 1  
Old 03-24-2009
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  
Old 04-21-2009
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
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX cluster disk usage report generation for yesterday & today and email

HI Team, I am trying to create a shell script to generate a yesterday and today report to compare and email in daily basis. can you please help me on the same. #!/bin/bash #Author: ******************* #Description: This script will return the following set of system information: ... (2 Replies)
Discussion started by: Mi4304
2 Replies

2. Shell Programming and Scripting

To get older than last 7days records using awk scripting to generate report and send email

Hello All, I have need as below: 1--> I need to get all users(who submit jobs) and their details by using below command: qstat -u \* output of the above command looks line below: job-ID prior name user-id state "submit/start at" queue jclass slots ja-task-ID... (5 Replies)
Discussion started by: VasuKukkapalli
5 Replies

3. Shell Programming and Scripting

UNIX script email to outlook report format

I have a ksh script that emails a report to outlook from a Unix Solaris. On server the report formatted perfectly. However, the email version the format is not. On the server report looks like this: TN Region Old SPiAD Server Order/Req Local Status NAAC Status Request Date New... (1 Reply)
Discussion started by: mrn6430
1 Replies

4. Shell Programming and Scripting

Automating

Hi All, I have a shell script that is integrated with a fault management system. It periodically monitors the system and raises an alarm. This script has different functions and it accepts input from us on the console. Is there any way to invoke it using a shell script ? Please advise. ... (2 Replies)
Discussion started by: praviper
2 Replies

5. UNIX for Dummies Questions & Answers

Automating a process

Could any one tell me , how to start a thread here, i just searching for so long. sorry to post in irrelavent here ---------- Post updated at 08:19 AM ---------- Previous update was at 08:00 AM ---------- Hi, I got a requirement to automate the process. We have SLA files, there are... (1 Reply)
Discussion started by: afahmed
1 Replies

6. Shell Programming and Scripting

Automating The process

Hi Guru's, I am trying to write a scripts that will automate my image provisoining process. Scenario: I have Linux Image Hosted on cloud which needs to be provisoned before it can be used. Currently we log onto the image through the putty on windows and connect to linux instance. I... (3 Replies)
Discussion started by: taqvia
3 Replies

7. UNIX for Dummies Questions & Answers

email sarg URL report link

Hello, sarg -l access.log -e johndoe@emailaddress.com will send text formated activity to John Doe. sarg -l access.log -u johndoe will generate user activity of John Doe from access.log file. Question: Is there way to send sarg generated URL Link for detail drill down to the user via... (0 Replies)
Discussion started by: paulds
0 Replies

8. Shell Programming and Scripting

Automating sendmail

Hi there, I am trying to send emails from within a shell script, and I need help. Also I am trying to send attachments from within a shell script. I am using sendmail. Regards (3 Replies)
Discussion started by: JimJim
3 Replies

9. Shell Programming and Scripting

automating password ?

Hi all, I want to write a script which logs into a database (DB2). To do this i need to have a password. This will be done lots and lots of times, so i need to modify the script to automate the response to the password request. How do i this, because at present i do the following: db2 connect... (3 Replies)
Discussion started by: Liamo
3 Replies
Login or Register to Ask a Question