Written by

Web Developer
Question Mack Altman · Sep 6, 2017

How can I use Task Manager to start a routine upon startup?

Currently, we are utilizing batch jobs at the OS level to kick off routines that watch for files. We are trying to convert these processes to be performed by the Task Manager.

The routines have while loops and perform while loops so long as the time parameters are being met.

What's the best way to ensure Task Manager kicks them off after the completion of the shutdown/backup/start process is performed, which we do nightly? I want to ensure that it starts it regardless of the time that we've set.

Comments

Mack Altman  Sep 20, 2017 to Dmitry Maslennikov

The Task Manager within Cache.

0
Mack Altman  Sep 20, 2017 to Fabian Haupt

Do you know if there is a way to do this within the Task Manager?

0
Mack Altman  Sep 20, 2017 to Fabian Haupt

To answer your first question, the server is restarted nightly to receive a daily backup.

Specifically, I am looking to find out if there is a way to do this within Task Manager.

0
Fabian Haupt · Sep 11, 2017

%ZSTART hooks allow you to reliably execute code after startup

0
Fabian Haupt  Sep 20, 2017 to Mack Altman

There isn't . You could hack something that's just running every minute and checking if your code is running?

0
Mack Altman  Sep 21, 2017 to Fabian Haupt

This is similar to what I ended up doing.

0
Mack Altman  Sep 21, 2017 to Eduard Lebedyuk

While I would love to use %ZSTART, we use a third-party application on our DB that we want to ensure our code isn't intermingled with, or inadvertently removed when the product owner decides to change dependencies of theirs within %ZSTART. Basically, we would know for certain that changes made within %ZSTART are only from that product owner.

This is a great idea as well.

0
Eduard Lebedyuk  Sep 21, 2017 to Mack Altman

It's really not.

You can have "On Demand" task and call it from %ZSTART. This way you can have task scheduler reporting and execute task only when it's required.

0
Eduard Lebedyuk  Sep 20, 2017 to Mack Altman

Is there any reason to use Task Manager instead of %ZSTART?

Anyway you can have a task that runs hourly, and checks for existence of ^CacheTemp.MyTask global. If the global does not exist, set it and execute the task. If the global exists - quit. Since restart wipes CacheTemp, the global wouldn't exist on startup.

0
Mack Altman · Sep 21, 2017

For those interested, I thought I'd share the solution we reached.

We have the Purge Task History job running each AM. We utilized this as a hook so that when this is completed it triggers the Tasks we want to run, essentially, at startup. This was done "How often do you want the Task Manager to execute this task?" to "After another task completes".

0