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.

0 734
Discussion (13)2
Log in or sign up to continue

Are you talking about Windows Task manager or in Cache?

The Task Manager within Cache.

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

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.

%ZSTART hooks allow you to reliably execute code after startup

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

This is similar to what I ended up doing.

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.

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.

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.

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".