SyntaxFix
Write A Post
Hire A Developer
Questions
You can set the s bit for your script so that it does not need sudo and runs as root (and you do not need to write your root password in the script):
s
sudo
sudo chmod +s myscript