OS: CENTOS 7
I have a MYSQL select statement that I would like to use with a bash script and then have it email the results. I need to have the results in the body of the message.
select distinct se.src_aet as "Ripped By", s.created_time as "Date/Time Sent", p.pat_name as "Patient Name", p.pat_id as "Patient ID", s.accession_no as "ACC #", p.pat_birthdate as "DOB", s.mods_in_study as "MOD", s.study_datetime as "Study Date", s.study_desc as "Study Desc", s.study_custom1 as "Inst Name"
from patient p
INNER JOIN study s
on p.pk = s.patient_fk
INNER JOIN series se
on s.pk = se.study_fk
where s.accession_no like '%OUT%'
and s.created_time >= curdate()
order by s.created_time DESC
There are an awful lot of ' " ' in the select statement and I was having a lot of issues with some of the bash scripts I found as example while trying to implement them. Not sure if it was because of the ' " ' or not. Maybe I could save this code to a .sql file and call it from the script?
I currently use 'mailx' to send mail in CENTOS
Ultimately I'll be wanting to run this as a cron job.