I have a script which returns a date (I can design the script to return the value in email), How can I design the script in AIX to invoke another shell script which performs some set of actions.
create an alias with the pipe symbol as fhe first charracter, followed by thename of the script to execute. the email complete with headers will be the standard unput
# echo "user.email: | /usr/libexec/mymailcheck.ksh" >> /etc/aliases
stopsrc -s postfix # ... or whatever mail server you are using
startsrc -s postfix # Ditto
Then a script like this as /usr/libexec/mymailcheck.ksh
#!/bin/ksh
while read line # Read each line of the email input (including all headers and other stuff you normally never see)
do
# Work out if we have a subject line and act on the subject
linetag="${line%% *}" # Get first word
if [ "$linetag" = "Subject:" ]
then
subject="${line#Subject: }"
logger "I have a subject \"$subject\""
# Whatever else you want to do here too.......
fi
done
Obviously do this on a test server and take a copy of /etc/aliases first.