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....
#! /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.