Monday, October 29, 2012

How to schedule a TWS job from the command line

Create a text file with the information of the job stream and the job. Make sure that the names of the jobs and the job streams are not the same as any other jobs on that machine. Then run the composer command to schedule the job.

To get a list of all the jobs on any system,
conman 'ds MACHINE_NAME#@' > all_jobs.txt

To check if you have used the name already,
cat all_jobs.txt | grep NEWNAME

Create a new file, new_job.txt, with content like this:

SCHEDULE MACHINE_NAME#JOB-STREAM-NAME
ON RUNCYCLE RC1 VALIDFROM 10/29/2012 "FREQ=DAILY;INTERVAL=2"
( AT 1230 )
KEYSCHED
:
MACHINE_NAME#JOB-NAME
 SCRIPTNAME "/path/to/some/dir/script.sh"
 STREAMLOGON username
 TASKTYPE UNIX
 RECOVERY STOP
 KEYJOB
END

This creates a schedule for a job which starts from October 29th 2012, and runs daily. There is an interval of 2 days between each run, so, the job runs on alternate days. Make INTERVAL=1 if you want the job to run every day.
TWS creates a new shell and logs into the system as 'username' and then runs the command. Make sure that username has permissions to execute the script.

Once the file is created and has all the details, run this command to schedule the job
composer replace new_job.txt

To check if the job has been scheduled properly, again run the conman ds command and check that the new job shows up.
conman 'ds MACHINE_NAME#@' > all_jobs.txt

3 comments:

Unknown said...

Hi Nitin,

I have some issue, Plz guide me.
1: I have one FTA in my envr. but when I start service than go tthe below error.
Error

AWSUI0796E The specified action cannot be performed.
Reason: AWSJSY404E The Symphony plan operation "startWorkstation" could not be completed because an error has occurred while accessing the Symphony plan. The error message is: "AWSBIN001E The workstation: ".." has not been initialized yet.".
I already delete the msx file pobox file and rm sym and syn filebut still not running. I installed this agent first time.

Unknown said...

One another issue i am facing.

how to installed new fta in TWS 8.6.
and how can I check the logs that from which id the job release and all.
Please help me out.

Nitish said...

Sorry, been a long time since I worked with TWS. I don't know the answers, and I won't be able to help now.