3

I use recoll to index files and it kicks in a inopportune times.

When I use htop to change the view to a tree view using F5 and filter the process list I see a master process running and child processes underneath it. When I press F9 to choose a termination option it doesn't seem to respond to the SIGTERM option so I have to use the SIGKILL option.

Is there an option to pause or stop the parent process and all its children rather than kill it outright?

1

You can press Space to tag a process. The kill command applies to all tagged processes.

There's no easy way to tag a process and its children, but the tree view (t) should list them contiguously.

Depending on how recoll is run, the processes may be in their own process group. If they are, then you can use kill -STOP -1234 to suspend them all, where 1234 is the process group ID (usually but not necessarily the process ID of the initial process in the group). You can check with ps -o pid,ppid,pgid,comm -C recoll, then ps -o pid,ppid,pgid,comm ww | grep -v recoll to see if there are any other processes in the process group. Htop doesn't have an interface to process groups.

If all the processes are called recoll, then an easier method is to filter the processes by name. In htop, use the filter command, then you can easily tag the processes you want to kill. On the command line, run ps $(pgrep recoll) to list the matching processes. If you're happy with the list, run pkill -STOP recoll to suspend those processes.

1
  • The indexer has one main process named recollindex and possibly many subprocesses in their own process group, each running a different command and which may themselves execute other commands. So I guess that none of the above will work. My suggestion, not directly addressing the question, would be to either run recollindex in batch mode (with cron), or outright kill it (SIGTERM) when you want it to stop. It is designed to exit gracefully, which may take a few seconds. Then maybe have a periodic cron to restart it in case you forget (recollindex guards against multiple instances). – medoc Jun 15 '17 at 6:32
1

Since version 2.0.0 (released in 2016), you can press c to tag the process and its children. This is mentioned in the built-in help which is shown on h.

Then you can press k to send a signal to the tagged processes; you'll be presented with the list of all possible signals to choose from.

0

You can choose to send the signal SIGTSTP or SIGSTOP:

  • SIGTSTP : Is the signal sent when you press Ctrl+Z. It will suspend and stop the process, you can resume it using bg (resumes it in the background) or fg (resumes it bringing it back to the foreground).

  • SIGSTOP: Simply stops the process. Can't be ignored can't be blocked. The process will only resume if you send it a SIGCONT signal.

2
  • 1
    The question is more about stopping or pausing the tree of processes in one go – vfclists May 21 '17 at 9:16
  • @vfclists I don't think that's possible without changing how the job/process behaves to the received signals. – M. Becerra May 21 '17 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.