(09-Oct-2020, 09:21 AM)agent_kith Wrote:(08-Oct-2020, 10:32 PM)PeteCallaghan Wrote: Or set it to run after boot:This will have the same problem with the current setup, as the script could be run before MPD has finished starting up... A workaround is to create a for loop (with sleep to throttle it down), and loop until pgrep returns a PID.
#crontab-e
@reboot root sh [path to script file]/mpdpriority.sh
You are right - I can't get this to work after reboot, even with this:
while ! pgrep mpd >> /dev/null ;
do
sleep 5
done
(09-Oct-2020, 06:22 PM)PeteCallaghan Wrote:(09-Oct-2020, 09:21 AM)agent_kith Wrote:(08-Oct-2020, 10:32 PM)PeteCallaghan Wrote: Or set it to run after boot:This will have the same problem with the current setup, as the script could be run before MPD has finished starting up... A workaround is to create a for loop (with sleep to throttle it down), and loop until pgrep returns a PID.
#crontab-e
@reboot root sh [path to script file]/mpdpriority.sh
You are right - I can't get this to work after reboot, even with this:
Code:
while ! pgrep mpd >> /dev/null ;
do
sleep 5
done
There seemed to be multiple mpd processes, so a loop was needed to catch them all:
pids=$(pgrep mpd)
for pid in $pids
do
chrt -r -p 99 $pid
cset proc --move --threads --toset=user --force --pid=$pid
done