60 lines
1.9 KiB
Markdown
60 lines
1.9 KiB
Markdown
- Run cron
|
|
<!-- Run simple -->
|
|
<!-- Cron run import product -->
|
|
|
|
wp cron event run wpi_import_products_cron --allow-root <!-- Call by cron -->
|
|
wp eval "do_action('wpi_import_products_cron');" --allow-root <!-- Call by CLI -->
|
|
wp eval "do_action('wpi_import_products_cron', ['worker' => 1]);" --allow-root <!-- Run with workers -->
|
|
|
|
<!-- Cron sync categories -->
|
|
|
|
wp cron event run wpi_sync_categories_cron --allow-root <!-- Call by cron -->
|
|
wp eval "do_action('wpi_sync_categories_cron');" --allow-root <!-- Call by CLI -->
|
|
|
|
<!-- Cron triger auto sync -->
|
|
|
|
wp cron event run wpi_trigger_import_cron --allow-root <!-- Call by cron -->
|
|
wp eval "do_action('wpi_trigger_import_cron');" --allow-root <!-- Call by CLI -->
|
|
|
|
<!-- Cron run workers -->
|
|
|
|
wp cron event run wpi_dispatch_import_workers --allow-root <!-- Call by cron -->
|
|
wp eval "do_action('wpi_dispatch_import_workers');" --allow-root <!-- Call by CLI -->
|
|
|
|
- Run Cron tabs
|
|
0 2 \* \* \* cd /var/www/html && wp cron event run wpi_trigger_import_cron --allow-root >> /var/log/wp-trigger-import.log 2>&1
|
|
|
|
- - - - - cd /var/www/html && wp cron event run wpi_import_products_cron --allow-root >> /var/log/wp-import-products.log 2>&1
|
|
|
|
- CLI WP
|
|
|
|
# Xoá dữ liệu
|
|
|
|
<!-- Products -->
|
|
|
|
- wp --allow-root post delete $(wp --allow-root post list --post_type=product,product_variation --format=ids) --force
|
|
|
|
<!-- Categories -->
|
|
|
|
- wp term delete product_cat \
|
|
$(wp term list product_cat --field=term_id --allow-root) \
|
|
--allow-root
|
|
|
|
<!-- Medias -->
|
|
|
|
- wp post delete \
|
|
$(wp post list --post_type=attachment --format=ids --allow-root) \
|
|
--force \
|
|
--allow-root
|
|
|
|
# Cài WP CLI
|
|
|
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
php wp-cli.phar --info
|
|
chmod +x wp-cli.phar
|
|
mv wp-cli.phar /usr/local/bin/wp
|
|
|
|
# Tìm kiếm tiến trình
|
|
|
|
ps aux | grep "wp eval" | grep "wpi_import_products_cron" | grep -v grep
|