Running an Alfresco Action after one week a rule is executed - alfresco

I wrote a script to run for an Alfresco rule. but I want the script to run after specific time ( I need the script to run after 1 week). any solution?
I read about Scheduled_Actions , is this feature useful?

Yes, in fact a Scheduled Action is likely your only option for for running something after a certain amount of time has elapsed.
At a high level your solution should look something like:
Your rule sets some aspect/property on the relevant node, say ruleDate, which is the date the original rule ran.
A scheduled action runs every day and detects nodes with a ruleDate 7 days or more in the past.
The scheduled action does whatever changes are required.
The scheduled action removes the ruleDate aspect/property.

Yes it is useful. You need to set up cron job to run scheduled task.
You can find more details on this link.

Related

How long does a control-M job stays in waiting state for the pre-requisites to be met by default?

If keep active is given as 0, how long the job waits for the pre-requisites to be met?
If keep active is given as 1, how long the job waits for the pre-requisites to be met?
My requirement is job should come into plan on certain time on first day and if pre-requisites aren't met that should go away from plan by the same time following(next) day.
Control-M works around the fundamental concept of New Day Processing (NDP). NDP sets up your scheduled jobs for the upcoming day and does housekeeping on the jobs that were there during the previous "day". The timing of your NDP is set by the CM Admin. Say, for example, your, your NDP is at 8 am and you have a new job that waits until 1 pm, has an input condition and keep active = 0. Should the input condition not show up then your job will be cleared out (unexecuted) at 8 am the next day.
If you have keep active set as 1 (or more) the job will survive NDP and potentially run (upon receiving the input cond) the next day. However it will wait on the from time (1 pm in our example) unless you use the "allow submission past next New Day" option. You can also set a "to" time, which sets the latest possible time for when the job could submit - unfortunately that would also limit you on the "first" day. To cleanup on the second day (in the way you describe) I think you'd have to create another job to manipulate the original (via ctmpsm ot the api).

Control-M avoid cyclic job from run before prev day's complete

I have a Control-M job that runs every 20 min. Everything works great during that day's run. The issue is when we auto-order the next days jobs. If the current day's jobs are running we get 2 copies of the jobs running at the same time.
Is there a way to not start the new job if the previous day's job is executing?
The job starts every 20 minutes, but how long does it run? Set the end window for "submit between" time a few minutes before the new day build.
Let's say your new day builds at 0400. Since the job is intended to run every 20 minutes, you can have it run as late as 0340. Set the "to" time in Activity Window to 0340 and the job won't autosubmit after that time. The new day will build at 0400 and the new version of the job will start then - 20 minutes after the previous start.
You can also add a control resource to the job to prevent two of them from running at the same time. I don't know another way to do it. That's not a can of worms I'd open unless the activity period settings just won't work the way you want them to.
If you're referring to last day's job execution bleeding into current day, causing resource contention, your best bet (as Rob pointed out) is to define a resource with max count of 1 to be required by the job, so next day job instance cannot start until prev day job completes and release the resource. Alternatively you can have the job post a Condition for order date + 1, and have order date condition also be an In condition for the job.

i want execute my previous days unexecute job first rather than today in Control-M

i am trying ordering my jobs into planing until jobs gets success,but when previous days jobs for that particular CTM table run then only today order jobs need to be run , i have added keep active for 10 days for each job.
thanks in advance
You can try adding an IN-CONDITION of the same job with PREV date, so that todays job will run only when yesterday's job has completed its run successfully.
If you want to run todays job even when yesterdays job fails, you can add a DO-STEP on failure, to create a condition which can be used by todays job to start running.

Taking an autosys job Off Hold but not wanting it to run immediately

I have 2 jobs in autosys: Job 1 and Job 2. Job2 will only run if Job1 is a success.
Now, in a normal scenario, Job1 and Job2 will run in succession as part of a daily batch.
But, sometimes, I need to re run Job1 without kicking off Job2. But if I just re run Job1, its success will automatically kick off Job 2.
So, I put Job2 'On Hold' and run Job1. All good so far.
Now, it is my experience that when I put Job 2 'Off Hold', it will immediately start running. I don't want that.
http://autosys-tutorials.blogspot.ca/2011/04/autosys-quick-reference.html
What I want is for Job2 to go into a Runnable state so that it gets picked up in the next batch run.
What status should I set Job2 to?
I am not sure whether you got answer for your doubt, there is one more option to do not let the ON_HOLD job to run immediately when off_hold it.
change the job 2 status from ON_HOLD to INACTIVE, so job 2 will not start immediately and same time job 2 will start running once condition(job 1 went to success state) met when job is in INACTIVE state.
If you mark the job 2 to ONICE, it will allow the dependent job to start if it has.
Regards,
Kaliraja (HP Autosys Team)
In this situation you should put Job2 'On Ice' before re-running Job1, instead of putting it 'On Hold'. From the link you posted:
The difference between "on hold" and "on ice" is that when an "on
hold" job is taken off hold, if its starting conditions are already
satisfied, it will be scheduled to run, and it will run. On the other
hand, if an "on ice" job is taken "off ice," it will not start, even
if its starting conditions are already satisfied. This job will not
run until its starting conditions reoccur.
You can put job2 on hold and run job1. After the completion of JOb1, change the status of Job2 to success,so that it can start next time as per schedule and based on its conditions.
Put Job_2 as 'On_Ice' before starting Job_1
You can place job 2 ON HOLD, But mark the job as success/Failure (ensure Job2 has no other dependency on this state)
You can put job2 on hold and run job1. After the completion of JOb1, change the status of Job2 to INACTIVE so that it can start next time as per schedule.
You could use override_job subcommand to bypass the execution only one time. The next schedule will automatically pick up the job to run.
This example shows how to define a one-time job override. The following script runs the job RunData with no conditions (where some had been previously specified) and outputs the results to a different output file:
UNIX:
override_job: RunData
condition: NULL
std_out_file: "tmp\SpecialRun.out"
If you want to cancel a override job defined, then use the below -
override_job: RunData delete
About your concern that you don't want to put Job2 'ON_ICE' because this will run the remaining jobs (job3 - job10), I think this scenario will not happen unless your main box is running. Since you've mentioned that you are going to run the job1 as standalone, the main box should not be running since, if so, job1 will be automatically triggered. Having said this, make sure that the main box is not running when you want to run the job1 alone. Else, the thing that your are saying will happen.
Options for the scenario:
1- Place job2 on "No Execution" each time you want to run ONLY job1, later remove it.
2- Place look-back as success condition as s(job1,0) on job2 for permanent fix to meet your adhoc request & permanent scheduled run if you are placing it on-hold & later removing it.
3- Place it on-Ice, but make sure there is no dependent job for Job2.
Put these jobs in the same box, put job 2 ON_HOLD, FORCESTART the box, wait for job 1 to finish with SUCCESS, KILLJOB the box, take job 2 OFF_HOLD, change status of all jobs in box to SUCCESS.

Which Activity to send a warning after X days, then a "You're Late email?

Full explanation. I currently have a Listen Activity with 3 branches. First branch is if the document is returned on time. Second is if after X days has passed the user gets an email warning them not to be late. Third branch is after Y days the document is late and the user gets an email stating that the document is late. The listen activity is within a while loop. Now the way I have it set up, I know that the workflow is going to execute the second branch every X days. I'm not quite sure how to set up the workflow so it execute the second branch, then if the document is still not returned, it will execute the third branch.
Any ideas?
Check out the Windows Server AppFabric / Workflow Services Demo - Contoso HR sample application. It does exactly what you are looking for.
Use a Pick activity as it will only execute one of the branches when its condition is matched and cancel the other branches. You can then use a delay to wait the period of time appropriate for the branch action.

Resources