A
A
Artyom2021-11-05 00:32:08
Database
Artyom, 2021-11-05 00:32:08

How to do actions at a specific time on the server?

Well, maybe I even formulated the question incorrectly. This is the first time I've encountered such a problem. I've seen this many times on other sites. Here, let's imagine. I need to make authorization through the code that I will send to the mail when registering a user. But, I want unconfirmed users to be deleted an hour after registration by the server. And accordingly, those that were confirmed, at the bottom, change the deletion time to null. I was able to write down the deletion time to the database during registration, we have it, like the record itself. How can I make the server at this time (or a little later, of course) delete the user. Maybe there is some kind of task scheduler that can execute a function at a specific time (I do it on a node) or something else. Nothing working comes to mind, maybe I’m looking badly, but I can’t find it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-11-05
@airman66

There is a CRON job scheduler. You can write a script that will delete entries from the database and run it on schedule. Suitable for your task.
There are SystemD timers a modern, convenient, method of periodically running tasks, devoid of the disadvantages of CRON, you can try it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question