I have created a cgroup to execute a bash script. The script works however annihilates my CPU and has been tested / proven to work. However my CPU tends to get annihilated when this happens, which is frankly expected as it is encoding after all. I created a control group and forced resource limits to the script to address the whole resource problem. With the cgroup, the file is made but seems like nothing happens.
Side note, I have tried to "set affinity" and use cpulimit aswell for alternatives with zero success. The control groups does indeed run the command with the resources it is set and does generate the new file, but never encodes. I am open to really anything at this point, but I need to control handbrakecli from just ripping into my CPU.
General Detail of Server
- XCP-ng / Xen Host
- Ubuntu 18.04
- HandBrake 1.2.1
Script
find /home/username/sharem/* -type f -size +4000M -exec bash -c 'HandBrakeCLI --encopts="coder=auto" -v0 -i "{}" -o "${0%.*}"-720p.mp4 --preset "Fast 1080p30"' {} \; -exec bash -c 'mv "${0%.*}"-720p.mp4 "${0%.*}".mp4' {} \; -exec bash -c 'rm "{}"' {} \;
Control Group
Code: Select all
[Unit]
Description=Encoding Video Files
[Service]
ExecStart=/bin/bash /home/username/maintain/bashhandbrake.py -d --foreground=true
MemoryAccounting=true
MemoryMax=1024M
CPUAccounting=true
CPUQuota=35%
[Timer]
OnCalendar=Mon *-*-* 5:00:00
Persistent=true
[Install]
WantedBy=multi-user.target
Log
There is no activity log, that I can find on the host. Open to providing it, if you can tell me what the name of the file is or command to make it. Yes I have read the article that was posted.