kill salt stuck job

From time to time our customers ask about the help with stuck salt jobs. The best way to check salt running jobs with salt-run as is described:

salt-run jobs.active

The result of following command should looks like:

20200507114933481142:
    ----------
    Arguments:
        - stucked-job
    Function:
        cmd.run
    Returned:
        - test-server
    Running:
        |_
          ----------
          test-server:
              1967
    StartTime:
        2020, May 07 11:49:33.481142
    Target:
        test-server
    Target-type:
        glob
    User:

We can find a jobid, which stuck and We can kill it with salt-util command:

salt '*' saltutil.kill_job 20200507114933481142

This command sends a kill signal (SIGKILL 9) to the named salt job’s process.

Reference: https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.saltutil.html

You can find more salt manuals https://linuxnotes.org/category/salt-manuals/

Viva La Linux!

Leave A Comment