Trigger MSTR events dynamically


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trigger MSTR events dynamically
# 1  
Old 04-11-2012
Trigger MSTR events dynamically

Hi, I need to trigger mstr events through unix by looking at a trigger file in a directory. For this i have created a text file (mstr_otc_st_events.txt) with trigger file and event name. Like this i have 3 trigger files and 3 events. The file is as follows,
Code:
Trigger1.TX|TRIGGER EVENT "First daily load complete
Trigger2.TX|TRIGGER EVENT "Second daily load complete"
Trigger3.TX|TRIGGER EVENT "Third daily load complete"

and the code is,
Code:
awk -F"|" '{
if (!system("test -f " $1))
{
print $1 " exists\nTriggering the MSTR event\n"
mstr_text_file="/tmp/mstr_text_'`date +"%Y-%m-%d"`.txt'"
print $2 > mstr_text_file
if(!system("/u01/app/MicroStrategy/bin/mstrcmdmgr -n '"$MSTR_PROJECT_NAME"' -u '"$MSTR_USER_NAME"' -p '"$MSTR_PASSWORD"' -f "mstr_text_file" -o '"$log_file_name"'"))
{
subject=$3
message=$4
system("/u01/app/admin/scripts/ksh/send_mail.ksh -s "subject" -f '"$POS_FROM_EMAIL_ID"' -t '"$POS_TO_EMAIL_ID"' -m "message"")
}
else
{
print "Failure"
}
close(mstr_text_file)
system("rm -f " $1)
}
}' ${SCRIPT_FILE_LOCATION}/mstr_otc_st_events.txt

This will trigger events dynamically by looking at text file. I can add more trigger files and events and use the same code without disturbibg it.

Now the problem is i am not able to trigger more than one event by looking at one trigger file. The new file is as follws,
Code:
Trigger1.TX|TRIGGER EVENT "First daily load complete"|TRIGGER EVENT "First daily load complete _ File"|TRIGGER EVENT "First weekly load complete"
Trigger2.TX|TRIGGER EVENT "Second daily load complete"|TRIGGER EVENT "First daily load complete _ File"
Trigger3.TX|TRIGGER EVENT "Third daily load complete"|TRIGGER EVENT "First daily load complete _ File"

I have to trigger $2, $3, $4 by looking at $1. I am not able to loop through the same row. How do i do it? Please help..


Moderator's Comments:
Mod Comment How to use code tags

Last edited by Franklin52; 04-11-2012 at 07:31 AM.. Reason: Please use code tags for code and data samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help not trigger the trap

mainpid=$$ (trap "echo timeout" SIGTERM SIGKILL SIGINT; sleep 5; kill $mainpid) & watchdogpid=$! sleep 10 #do something kill $watchdogpid I design a timeout function script I don't see the echo "timeout" is on the screen (1 Reply)
Discussion started by: yanglei_fage
1 Replies

2. Shell Programming and Scripting

Automatic script trigger

Hi, I'm looking for a way to solve the following scenario: A shell should automatically trigger / run when a text file is placed or present at a specific location. My idea - to create a cron / anacron for every minute and inside that i will call a temp script. Temp script will move to my... (9 Replies)
Discussion started by: Gautham
9 Replies

3. OS X (Apple)

AC to DC trigger pulse for AudioScope.sh.

Hi all... Has _below_ ever been done in UNIX shell scripting before? (I have done this easily in Python but this is using purely the shell.) The DEMO version IS built and has been tested. Pre-amble... I now need at least one control pulse for the AudioScope.sh when in PURELY audio I/O mode,... (2 Replies)
Discussion started by: wisecracker
2 Replies

4. HP-UX

Control-M Job trigger

Hi, I'm totally new in Control-M and I really need some help. Here's my problem. I need to make job X from a server trigger job Y from a different server where job X must receive a confirmation first before execution. :confused: I really have no idea on how to do that so can you please give... (1 Reply)
Discussion started by: criphaze22
1 Replies

5. UNIX and Linux Applications

update trigger

hi all, i hope i am posting this /beginner) question in the right forum: i want to create an update trigger, which rolls back a transaction if a record of a table is updated. the table has - amongst others - a field 'statusid' - if a record in this table has the statusid X and it is attempted... (0 Replies)
Discussion started by: kalinkula
0 Replies

6. Shell Programming and Scripting

Trigger with condition

If test.ksh is successful then I have a sequence of script which needs to execute automatically. Is it possible to capture the return code to execute the next script automatically? what is better way of doing this. (4 Replies)
Discussion started by: zooby
4 Replies

7. Shell Programming and Scripting

Trigger Enter

Hello, I need to trigger every time enter has been clicked while some one on terminal i tried to googleit but with out result any idea ?? thanks in advance (3 Replies)
Discussion started by: AYAK
3 Replies
Login or Register to Ask a Question