2 Replies Latest reply on Jan 20, 2014 3:00 PM by Falko Schmieder

    Sysout as email body

      Share This:

      Hi,

       

      I have a job in which I can attach the sysout and get as email attachment. Instead of attachment, I would like to get the content of sysout as email body. Is it possible?

       

      Or, If I have a log file, can I read the content of the log file and include in the email body?

       

      To better explain my scenario, I have a script which generates a report in tabular format. If I get it as sysout attachment, its a text file and I am losing all formatting. Hence I want it in email body with proper formatting. Is it possible?

       

      Thanks

      Sharath

        • 1. Re: Sysout as email body
          Mark Francome

          Can be done but needs a bit of a work-around -

           

          1. In the job, create an On/Do Step for the scenario that you want to generate an email for. In the "Do" add a "Set-Var" with "Name=\MY_ORDERID" and "Value=%%ORDERID". Still within the same "On" add a "Do" for "Force-Job".

           

          2. The job specified in the "Force-Job" above should be an unscheduled command line task that does this and runs on the Control-M Server via the Control-M id -

           

          ctmpsm -LISTSYSOUT %%MY_ORDERID | mailx -s "Job has run - see output below" John.Doe@hotmail.com

           

          You may want to add more variables being saved in the "On/Do" in step 1 (e.g. I save the NODEID, RUNCOUNT and MEMNAME to include in the email header).

          • 2. Re: Sysout as email body

            to avoid a lot of jobs in your active environment (1 for every mail sent), you could also start this code snippet from Marc with a shout command (with the parameters as message).

            However, this only works if your scenario is quite simple (job ok/ not ok .. ) and you can describe it within the options at the shout tab.