Run a Task Scheduler Batch File that sends out an email before Server 2016 Shutdown - shutdown

I have a cmd file that sends out an email (email program -> stunnel -> gmail).
I have a Task Scheduler task that triggers when the computer (Windows 2016) starts - No problems here.
I would like to setup a Task Scheduler action that does the same thing when the computer is shutting down. The batch file takes about 10 - 20 seconds to execute and needs to be able to access the internet in order to send out the email.
I am aware that one can tie an event in Task Scheduler to the Event Viewer but do not know the event I should latch on to.
Thanks.

I managed to generate the email by triggering on any one of these event IDs 1074, 6006, 6008.

Related

AWS EventBridge wait on event

I'm trying to build a serverless async polling service that triggers an async data request, waits for it to finish (by trying periodically) and then polling the response once its ready.
Ideally, I would trigger the data request with Lambda and push an event for EventBridge to later be processed by another Lambda that queries the API to see if the reseponse is ready, and if not - push a new event to EventBridge to try again later. For that to work, I need a way to make EventBridge wait before it forwards the event onwards. I'm trying to come up with a solution that doesn't require Lambda idle time.
Is there a way to make EventBridge wait on an event before it is pushed onwards? Or alternatively to setup a one-time scheduled event?
Sounds like the newly announced EventBridge scheduled events would solve your problem! You could simply schedule your event for Date.now() + x seconds or similar.
Announcement blog post: https://aws.amazon.com/blogs/compute/introducing-amazon-eventbridge-scheduler/
AWS Docs: https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html
Amazon SQS delay queues provides that functionality:
Delay queues let you postpone the delivery of new messages to a queue
for a number of seconds, for example, when your consumer application
needs additional time to process messages.

Why task launcher prunes the task instance history every time a new task instance is launched?

When the Spring Cloud Data Flow server uses local deployer to handle the task lifecycle management(launch, stop, etc.,), the corresponding task execution log can be obtained only when the task execution status is RUNNING.
This is by design because the local task launcher prunes the task instance history every time a new task instance is launched and hence the access to the log is not available, which is explored by the code here.
The reason was not to grow the number of Task process IDs in the local deployer' in process Map. You can see the issue related to it here.
But, this causes some side effects as discussed in another thread as not being able to show the previous instances' task execution log in local deployer mode.
I think it would be ok to consider having some X number of task executions in history and that way at least we can avoid these side effects for a few executions in the history. Created a GH issue to track this.

Sidekiq Pro callback when batch is retried?

I'm using sidekiq pro for my application, and it's been working great. But I'd like to have a way to notify my users that a failed job is being retried.
A flow would go something like this:
Batch starts
worker1 runs successfully
worker2 runs successfully
worker3 fails
oncomplete fires, stuff happens
worker3 restarts
** onretry fires, notification sent to user
worker 3 runs successfully
onsuccess fires, stuff happens
My imaginary onretry doesn't exist in the documentation but I'm hoping there's a way to fake it. I know that I can tell if the batch has failures via the status object, but I don't see a way to get a retry event. Is there such a thing?
The most workable approach is likely a server-side middleware which can detect a retry in progress for a batched job and send an email.

How to handle pending connections to a server that is designed to handle a limited number of connections at a time

I wonder what is the best approach to handle the following scenario:
I have a server that is designed to handle only 10 connections at a time, during which the server is busy with interacting with the clients. However, while the the server is busy, there may be new clients who want to connect (as part of the next 10 connections that the server is going to accept). The server should only accept the new connections after it finishes with all previous 10 agents.
Now, I would like to have an automatic way for the pending clients to wait and connect to the server once it becomes available (i.e. finished with the previous 10 clients).
So far, I can think of two approaches: 1. have a file watch on the client side, so that the client will watch for a file written by the server. When the server finishes with 10 clients, it will write the file, and the pending clients will know it's time to connect; 2. make the pending clients try to connect the server every 5 - 10 secs or so until success, and the server will return a message indicating whether it is ready.
Any other suggestion would be much welcome. Thanks.
Of the two options you provide, I am inclined toward the 2nd option of "Pinging" the server. I think it is more complicated to have the server write a file to the client triggering another attempt.
I would think that you should be able to have the client waiting and simply send a READY signal. Keep a running Queue of connection requests (from Socket.Connection.EndPoint, I believe). When one socket completes, accept the next Socket off the queue.

concurrent application

i have used erlang for the passed five month and i have liked it now it is my time to write down a concurrent application that will interact with the YAWS web server and mnesia DBMS and to work on a distributed system may any one help me with a sketchy draft in Erlang?
i mean the application should have both the sever end and the client end where by the server can accept subscriptions from clients, Forwards notifications from event processes to each of the subscribers, accept messages to add events and start the needed processes, can accept messages to cancel an event and subsequently kill the event processes. whereas the client should be able to ask the server to add an event with all its details,ask the server to cancel an event, monitors the server (to know if it goes down) and shut down the event server if needed. The events requested from the server should contain a deadline
Spend some time browsing github, you can find projects corresponding to your description:
http://www.google.ca/search?hl=en&biw=1405&bih=653&q=site%3Agithub.com+erlang+yaws+mnesia&aq=f&aqi=&aql=&oq=

Resources