I just configured jenkins and in the pre-build steps i am trying to restart jenkins but i end up with the following error
Commencing build of Revision c5b9f8daac
Please use the "id" command and paste the output. Only if you are in admin group then you don't need password but for all other even though you have access but you need to type the sudo password. In this case sudo doesn't have a tty to ask for the password and hence the error.
One solution could be, don't use sudo only for mysql restart, instead run the entire script as sudo "sudo {your script path}" in this case sudo will have the terminal to ask for the password.