Support » Fixing WordPress » Stop CLI media import command

  • ianatkins

    (@ianatkins)


    Hello.

    Am trying out WordPress CLI to import in a large folder of media. Works really well – but couldn’t work out how to stop the import process, is that possible?

    Was running wp media import *.jpg on a folder with a few thousand images.

    Was connected to our server using SSH, tried typing ‘exit’ but that then quit the SSH connection, but only after the media import was complete.

    Thanks.

    Ian.

Viewing 2 replies - 1 through 2 (of 2 total)
  • phillcoxon

    (@phillcoxon)

    Hi @ianatkins,

    Unless you are specifically telling wp-cli to run using a separate bash thread you should be able to use CTRL-C to interrupt it any time.

    [user@server public_html]$ wp plugin list
    ^C
    [user@server public_html]$

    If you start a wp-cli command to run in the background, you can use the jobs command to identify it and bring it back to the foreground where you can use CTRL-C:

    [user@server public_html]$ wp plugin list &
    [1] 21729
    [user@server public_html]$ jobs
    [1]+  Running                 wp plugin list &
    [user@server public_html]$  fg
    wp plugin list
    ^C
    [user@server public_html]$

    The exact commands may vary depending on your version of linux but I think it’s pretty consistent across all major operating systems.

    If you are using commands like screen or tmux to leave processes running on the server while you log out then you will need to log back in and use screen/tmux to reconnect to the shell you are running the task in and then follow the above steps. I’ll leave it to you to explore the screen/tmux documentation. 😀

    Hopefully that helps?

    @phillcoxon Great thanks very much for the pointers! As you may of guessed am not much of a command line guy!

    Thanks,

    Ian.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.