I have a batch file that runs every 5 seconds(via systemd).Its task is to run the script in the application.The application is written in a PHP framework and uses routing.

I had a choice - to launch the application using routing - that is, through a post-request from a batch file.Or by a command from the batch file to execute the file?

Posting a request is more convenient for me, because the architecture of the framework is built through routing.But the question is whether there will be problems with sending requests every 5 seconds.In general, is it faster, a command or request? I would appreciate any advice.
  • And ubuntu here what side? – Fabulous60 Jun 15 '19 at 11:40

2 Answers 2

The team is faster anyway, and so all healthy people do.Besides, it is worth using cron
  • Thanks, I use systemd – Dizzy100 Jun 15 '19 at 11:33
  • Dizzy100, if you have your own server, then do what you want, of course, but there’s no place for that.And on many hosts you won’t get such rights – European13 Jun 15 '19 at 11:34
  • That's just the cron should not be used to run long commands. – Panicky96 Jun 15 '19 at 11:36
  • Panicky96, do not execute long commands) because I’ve seen a long script work related to ETL, warming up caches or data migration.All this is done now in other human ways – European13 Jun 15 '19 at 11:38
  • European13, which means"do not"?
    How to make RabbitMQ Consumer not long, for example?
    Or a web server server?
    – Panicky96 Jun 15 '19 at 11:58
  • Panicky96, oh, I understood - we are talking about a different context.Within the TS, it’s a planner, not a demon, and your cases are completely correct, I agree.Although I used Supervisor for this task – European13 Jun 15 '19 at 12:08
  • European13, no why, I use sustemd as a timer, sustemd is a demon as far as I understand. – Dizzy100 Jun 15 '19 at 14:26
  • Dizzy100, by the fact that its main purpose is to start and monitor daemons and services.You can use it as a timer, but it was not done for this) – European13 Jun 15 '19 at 14:56
  • European13, I do not agree, in systemd there are units with the .timer extension that are intended for this purpose.What is the point of writing a daemon with timing that will be controlled by systemd if systemd itself is a timing daemon. – Dizzy100 Jun 15 '19 at 16:34
  • Dizzy100, well, it's up to you, as they say) – European13 Jun 15 '19 at 16:35
  • European13, the point is not that I consider this option ideal(although I consider it good).There is no better option, or I don’t know it, and no one has suggested it yet. – Dizzy100 Jun 15 '19 at 16:47
  • Dizzy100, yes, a good option is that, unless there is no need to climb from under sudo – European13 Jun 15 '19 at 16:48
Requests are not needed there.All popular frameworks allow you to add console commands without problems, and have separate controllers for this business.