Author |
Message |
mbenton
Joined: 08 Feb 2010 Posts: 38 Country: United Kingdom |
|
Macro-parameters - Visibility |
|
24x7 Multiplatform 4.3 build 293 on Red Hat Linux.
Q: Is there a method to reference the 24x7 Macro-parameters from within a "Run Program or Batch File" shell script Job ?
I am invoking various korn shell and Tcl/Expect scripts, and would like to use the values of such variables as @V"job_id" @V"job_name" etc.. within these scripts.
I am looking to produce a standard job header to be placed at the top of the job stdlist output. This header would contain info similar to the following;
==============================================================="
= JOB NAME : @V"job_name"
= JOB ID : @V"job_id"
= USER : @V"user"
= SCRIPT : /scheduler/scripts/${scriptname}"
= Job Number: @V"job_number"
= QUEUE : @V"queue"
= DATE/TIME : $(date)
==============================================================="
or, should I run two jobs, chained together ? The first job to produce the header, and the second which runs the script ?
|
|
Tue Feb 09, 2010 9:17 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
|
|
You can surely do that using "Run script" job type and selecting "Shell/batch script" for the script type.
I'm not familiar with Tcl/Expect and don't know if that will work. Technically "Shell/batch script" jobs behave as regular shell scripts except that files are generated and deployed to the target system dynamically during job run-time. File run-time names and extensions are platform dependent, on *nix system 24x7 uses .sh for the shell script extension.
|
|
Tue Feb 09, 2010 9:39 am |
|
 |
mbenton
Joined: 08 Feb 2010 Posts: 38 Country: United Kingdom |
|
|
|
I have created a new Job of type "Run Script" / "Shell/batch script" which contains the following;
#!/bin/sh
echo @V"job_name" >> /scheduler/logs/test.log
echo "@V'job_name'" >> /scheduler/logs/test.log
echo '@V"job_name"' >> /scheduler/logs/test.log
Looking at the produced log file, i find;
/scheduler/logs : cat test1.log
@Vjob_name
@V'job_name'
@V"job_name"
Q: Any idea as to the correct way to display the Macro-parameters from the internal 24x7 shell script ?
|
|
Tue Feb 09, 2010 10:28 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
|
|
Let me check that.
|
|
Tue Feb 09, 2010 10:37 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
|
|
My local version is more recent here and the following syntax works fine for me
 |
 |
#!/bin/sh
echo @V"job_name" >> /scheduler/logs/test.log |
I'm going to email you a link for updating your version. The email should come from our general support account.
|
|
Wed Feb 10, 2010 12:51 am |
|
 |
|