Tag Archives: Command Manager

Triggering Narrowcast Jobs from Command Prompt

When I was a project manager, the developers that I worked with setup the Narrowcast jobs to kick off automatically once the ETL loads had completed.  Well, I recently had to figure out for myself how to do this, and after piecing all the technologies together and reading through a few MicroStrategy support notes, I felt it would probably be a good thing to document in this blog.   The below example was performed using a Windows NT Narrowcast server.

Well, triggering Narrowcast Services, first off can be done through MicroStrategy Command Manager. If it is not installed on your Narrowcast box, first go ahead and install the application there.

You will then need to log on to your Narrowcast Meta data from Command Manager in order to test your connection.   First off, your Narrowcast implementation and Command Manager install needs to be at the same support level, so I had to first upgrade my Narrowcast application.   Second, you have to setup a system DSN for your Narrowcast Metadata.  From there, you can log on to Narrowcast Metadata from Command Manager.  Here is some sample Command Manager code for kicking off a Service:

TRIGGER SERVICE “Service Name” IN FOLDER “Applications/My Applications/Services/”;

In Command Manager, I then save this code into a .scp file.  In order to kick off this Command Manager file, we then create a windows .bat with the following commands:

if not exist c:\cmdmgr\trigger.txt goto 20

cmdmgr.exe -w SQLServer -u user -p pass -d master -s dbo.PROD -f c:\cmdmgr\job.scp -o c:\cmdmgr\output.txt

del c:\cmdmgr\trigger.txt

goto end

:20

:end

This windows first checks for a trigger file (that will be supplied by the ETL team).  If the trigger file exists, then it kicks off the .scf script and then deletes the trigger file.    If the trigger file does not exist, then the .bat files does nothing.  Shown below is the command manager line explained further:

fig61

If you are having problems with the script, just test the cmdmgr.exe line in the .bat file.   You should be able to doubleclick the .bat and the service should run almost immediately.

Once you have all the above setup, it is just a matter of scheduling the .bat file to run every so often (15 minutes in our case).   I have yet to find a true trigger solution using Narrowcast.   I always have to setup a job which runs repeatedly until a flag is set, and then the job kicks off the actual report service.   Whether this flag is a database flag or a trigger file, the word ‘trigger’ is misleading because the report service is not really being triggered by the ETL load completion.  A easier solution for triggering Narrowcast jobs would be a very nice to have in one of Narrowcast’s later releases.

Just FYI, in order to schedule the .bat file to run every 15 minutes, I went into Settings->Control Panel->Scheduled Tasks, and just created a Scheduled Task using the wizard.   Click on the Advanced push button to select a schedule that is more frequent than just once a day.

This was not rocket science, but just thought it would be something nice to document.