it worked in single shot but I want to understand more about above command execution, I understand
cd /tmp; ./OpenfileLimit.sh and even tried this way too, something like below.
appendfile cd /tmp
move __appendfile run.sh
chmod 755 run.sh
wait /bin/sh run.sh
but mine didnt worked, and I guess the way you have putted
sudo su - root -c seems solved the issue.
Please provide more info on
wait sudo su - root -c