I need to run a program with a bash script. This program may require a larger than default message queue.
I know I can increase it with:
sudo sysctl fs.mqueue.msg_max=3000
And I could, for instance, check it with:
echo "$(sysctl fs.mqueue.msg_max)"
which would print, for instance fs.mqueue.msg_max = 100"
I need to create a conditional if to increase the size if it is less than a threshold value (and do nothing otherwise).
I expected it to look like:
queue_size=$(sysctl fs.mqueue.msg_max)
if (($queue_size < 3000))
then
sudo sysctl fs.mqueue.msg_max 3000
else
echo "message queue large enough at $queue_size"
fi
But this returns:
((: fs.mqueue.msg_max = 200 < 3000: syntax error: invalid arithmetic operator (error token is ".mqueue.msg_max = 200 < 3000")
As queue_size received an object which is not the queue size, but something I don't understand nor know how to manipulate.