Skip to content

Instantly share code, notes, and snippets.

@molotovbliss
Last active February 16, 2018 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save molotovbliss/5ad17a9d56ffb9b252cc28b0164688d1 to your computer and use it in GitHub Desktop.
Save molotovbliss/5ad17a9d56ffb9b252cc28b0164688d1 to your computer and use it in GitHub Desktop.
Run Magento 2.x `bin/magento catalog:images:resize` in bg process, while continuing even after SSH session logout.

Push a command to run immune to hangup signals, and hopefully SSH clients crashing, while logging errors & output to a log file. Avoid re-executing if SSH timeouts occur, internet/VPN crash, etc.

Standard bin/magento example:

nohup php -f bin/magento catalog:images:resize > var/log/catalog_images_resize.log 2>&1&

For those who prefer n98-magerun2.phar

nohup n98-magerun2.phar catalog:images:resize > var/log/catalog_images_resize.log 2>&1&

Any other Magento 2.x bin/magento can run as bg process with output/error logging, all while continuing to execute even after SSH session logout.

In particular the very long running process catalog:images:resize on very large 100k+ catalogs.

nohup bin_exec params>log.file 2>&1&

reference:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment