简体   繁体   中英

Timeout of artisan commands in Laravel

I want to build a pure cli application with Laravel utilizing Laravels Artisan Commands.

Now I wonder if those commands behave like any other php script called via CLI.. A normal behavior would be that a php script called via CLI potentially runs for ever. This is the exact behavior I want for my Artisan Commands.

So the questions are:

  • does a command called via php artisan <command-category>:<command> has a timeout?
  • does a Job triggered from the Artisan Command has a timeout (compared sync-/database-mode)?
  • if Commands time out, do they time out when called from a php script called via CLI, too?

I have an FTP-Server which recieves several uploads per day. Those uploads are zip-archieves with sizes up to 3GB. What I want to build is a script, is to loop over allthe archieves and do the following:

  1. backup the archieve on a s3-compatible storage-system (DigitalOcean)
  2. extract the archieve on the ftp-server
  3. copy those files on a another s3-compatible storage-system
  4. delete the local copy of the zip-file

does a command called via php artisan : has a timeout?

There is no timeout as of default that's handled by Laravel, as these are in base just a normal php process. There is thereby no way of killing these long artisan processes.

The only limit that may cause interference is, as aforementioned, your php server. For example, the setting max_execution_time in your php.ini may interfere.

Since you are transferring files then I suppose settings like upload_max_filesize may cause interferences. This, I'm not sure however.

does a Job triggered from the Artisan Command has a timeout (compared sync-/database-mode)?

All artisan commands are basically php processes. The same answer as to your first question applies here as well.

if Commands time out, do they time out when called from a php script called via CLI, too?

Yes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM