#! /bin/ksh
#[[ -f ./.profile ]] && . ./.profile 2>/dev/null
if test -f '.profile'; then . ./.profile; fi;
#. .profile
LOG_DIR=/app/rpx/jobs/scripts/just/logs
sendEmail()
{
pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7"
(
echo "From: $pzFrom\nTo: $pzTo\nSubject: $pzTitle${pzReplyTo:+\nReply-To: $pzReplyTo}"
[[ -n "$pzCType" ]] && echo "Content-Type: $pzCType"
echo
echo "$pzMsg"
[[ -n "$pzFiles" ]] &&
echo &&
for pzFile in $pzFiles
do
[[ -f "$pzFile" ]] && uuencode "$pzFile" "$pzFile"
done
) | mail "$pzTo"
}
## all pending subscriber .
pending=`sqlplus -s pag_app/wired01@prpx1-vip.unix.gsm1900.org:7779/prpx.unix.gsm1900.org <<EOF
set feedback off;
set heading off;
set trimspool on;
set pagesize 0;
SET LINESIZE 180;
select msisdn , status_changed_time, rate_plan_id, status from subscriber where status = 'P' and status_changed_time < sysdate orde
r by 2 desc;
EOF`
activating=`sqlplus -s pag_app/wired01@prpx1-vip.unix.gsm1900.org:7779/prpx.unix.gsm1900.org <<EOF
set feedback off;
set heading off;
set trimspool on;
set pagesize 0;
SET LINESIZE 180;
select msisdn , status_changed_time, rate_plan_id, status from subscriber where status = 'I' and status_changed_time < sysdate orde
r by 2 desc;
EOF`
final="Pending
$pending
Activating
$activating"
sendEmail '' "Pending_Activating" "$final" 'xyz@gmail.com' 'abc@gmail.com' " " ' '
What "table format" do you mean/need? Those sql queries should deliver columnized output anyhow.
You might want to obfuscate the connection info in your sql queries.
You mean character semi/pseudo graphics? Use "|" for the column separator and a line of "-" for header and footer each.
can you please give some example to implement it ? that would be really a great help