Sponsored Content
Top Forums Shell Programming and Scripting Automatic Email of Log Files in OSX Post 302483083 by DotNaBox on Thursday 23rd of December 2010 02:24:32 PM
Old 12-23-2010
Automatic Email of Log Files in OSX

Hi,

I am trying to write a shell script that will take the log files from a single folder (all ending with .log), put them into an archive, use something to encrypt the file, and then emailx to email the resulting encrypted archive to me.

Of course, I am open to suggestions on how to improve this process. Essentially, I need this script, when run, to email me log files in a secure way.

Or, even better, if the script could run automatically. But I'll worry about that later.

So far....
Code:
#! /bin/sh

logPath="/PHSLogs"
archiveName = `date {y}--{m}--{d}_{h}-{m}-{s}`

gzip -r $logPath    <--- How do I specify that I want the archive name to be $archiveName?

#What do I use to add some form of strong-ish encryption to the archive?

#What would be the appropriate syntax for emailx? Or is there a better way to transfer the file back to me?
mailx -s "$archiveName" user@domain.com < $logpath/log.gz

Seems strange, I know. It's for a very particular task at work I'm working on. Rather than spending hours trying to figure this out, I was hoping to receive some help along the way. Thank you so much for your time.

Edit: Added what I think should work for emailx syntax.

Last edited by DotNaBox; 12-23-2010 at 04:23 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

automatic transfering of files using scp

I'm in the process of writing a shell script with copies files from one linux box to another using scp. I wish to run this through a cronjob so it cannot be interactive. This is what I have so far. #!/bin/sh PASSWD='passswd' dateset=$( date | awk '{print $2 $3 $6}') for dates in $dateset;... (1 Reply)
Discussion started by: tcruicksh
1 Replies

2. Solaris

Automatic Log files to my E-mail.

Hi, I have 6 servers, I want to make a script to read the messages (/var/adm/messages) file daily in the morning and send it automatically to my E-mail address. Regards (2 Replies)
Discussion started by: adel8483
2 Replies

3. Shell Programming and Scripting

Script for automatic deletion of old files

Hi, I have a folder with limited space. I do not have provisions to increase the space for this folder. So i have to delete files which are more than 1 month old automatically. But, i need to maintain the files created by 4 users and delete all the other files automatically which is more than 1... (4 Replies)
Discussion started by: vivek_scv
4 Replies

4. UNIX for Dummies Questions & Answers

where are my email log files

I am trying to find the email log file that would have info on users downloading their pop mail. Our email is hosted on a unix server running apache. I am not sure the exact version of mail software running, but when I telnet to the mail server the response I get is this "+OK POP3 v2003.83rh... (3 Replies)
Discussion started by: mstarcom
3 Replies

5. OS X (Apple)

Automatic device recognition in OSX

Can anyone point me to a resource (or answer my question) that will show me how to automatically run a script in OSX when a device is plugged in. The OS recognizes that the device is plugged in but how do I direct it to do something I want it to do. it seems that linux has udev but what would... (2 Replies)
Discussion started by: djkuzenko
2 Replies

6. Shell Programming and Scripting

Email script when automatic backup is finsihed

Hello all, i'm still new to this site and thought i might find some help here :). lately i performed a script to make an automatic backup of some files in certain directories. the script looks something like this: #! /bin/bash ##############VARIABLES path=/export/home/cassi/Backup... (5 Replies)
Discussion started by: Wizard_1979
5 Replies

7. OS X (Apple)

OSX: Syncing VERY large video files across web

My impressions from recent web explorations has me questioning the appropriateness of rsync ( or rsyncx ) for syncing large video/movie files to remote locations. Background: A friend who edits and creates movies would like to sync his video files from his place of business to his home. These... (2 Replies)
Discussion started by: Bubnoff
2 Replies

8. Shell Programming and Scripting

Shell script for sending automatic email to personal mail id

hi guys, I need a shell script to send mail automatically to my personal mail id like xxxx@hotmail.com but while experimenting with "mail" command I faced following problems. cat text1.txt | mail -s 'test mail' xxxx@hotmail.com command successfully executed but while checking for... (4 Replies)
Discussion started by: rrd1986
4 Replies

9. UNIX for Dummies Questions & Answers

Help: Add email users in OSX terminal

Please forgive me if this is the wrong place to post. I am a VERY basic user here and have been tasked with adding a user to our email system -- we use a squirrelmail interface and I have root passwords etc. I tried logging in through a browser but get this error: ERROR: Connection dropped... (1 Reply)
Discussion started by: dperro01
1 Replies

10. OS X (Apple)

Help: Add email users in OSX terminal

Please forgive me if this is the wrong place to post. I am a VERY basic user here and have been tasked with adding a user to our email system -- we use a squirrelmail interface and I have root passwords etc. I tried logging in through a browser but get this error: ERROR: Connection... (1 Reply)
Discussion started by: dperro01
1 Replies
BF_TAR(1)						    Bogofilter Reference Manual 						 BF_TAR(1)

NAME
bf_tar - shell script to write a tar file of a bogofilter directory to stdout SYNOPSIS
bf_tar [-r] [-R] bogofilter_directory DESCRIPTION
bf_tar bundles a bogofilter working directory in tar format and copies it to standard output (your console, or where you redirect it, see EXAMPLES below). OPTIONS
The -r option causes bf_tar to remove inactive log files after the archive has been written successfully. The default is to leave log files. The -R option causes bf_tar to remove inactive log files before the archive is written. This may reduce chances that the resulting archive is recoverable should it become damaged. The archive may be smaller though. The default is to leave log files. EXIT STATUS
The script exits with status code 0 if everything went well, and nonzero if it encountered trouble. EXAMPLES
o bf_tar ~/.bogofilter > outfile.tar Writes a standard .tar file containing the essential files from ~/.bogofilter to outfile.tar. o bf_tar ~/.bogofilter | gzip -9 -c > outfile.tar.gz Writes a gzipped .tar.gz file containing the essential files from ~/.bogofilter to outfile.tar.gz. o bf_tar `pwd`/mydirectory > outfile.tar Prepend $(pwd)/ or `pwd`/ if you want to specify an absolute path instead of a relative path. NOTES
This script is meant for use with Berkeley DB based bogofilter versions. This script requires a SUSv2 compliant pax utility. This script expects a SUSv2 compliant shell. Solaris systems should have the SUNWxcu4 package installed (when bogofilter is configured) so that /usr/xpg4/bin/sh can be used. AUTHORS
Matthias Andree Bogofilter 03/15/2010 BF_TAR(1)
All times are GMT -4. The time now is 11:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy