I have a situation where a process that hangs under certain circumstances or runs for too long should be killed. Also I don't want the process to take 100% of the CPU time. I am thinking that I should combine cpulimit
and timeout
.
I can get each command to work separately but not together:
cpulimit -l 20 -- /usr/lib/libreoffice/program/soffice.bin --headless --convert-to pdf broken.docx
timeout -k 6 -s 15 6s /usr/lib/libreoffice/program/soffice.bin --headless --convert-to pdf broken.docx
I would like to do something like:
cpulimit -l 20 -- | timeout -k 6 -s 15 6s /usr/lib/libreoffice/program/soffice.bin --headless --convert-to pdf broken.docx