Sponsored Content
Full Discussion: Automating Email SUS report
Operating Systems OS X (Apple) Automating Email SUS report Post 302309015 by mlott on Tuesday 21st of April 2009 01:42:16 AM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

7. 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

8. 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

9. 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
dos2unix(1)						      General Commands Manual						       dos2unix(1)

NAME
dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates dos2unix under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format. dos2unix a.txt -c iso b.txt dos2unix -c ascii a.txt -c iso b.txt dos2unix -c mac a.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org> MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
unix2dos(1) mac2unix(1) 1995.03.31 dos2unix v3.0 dos2unix(1)
All times are GMT -4. The time now is 06:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy