Feb 7, 2013

Jenkins? Tomcat? Running Code w/ Permissions? This script will probably help you!

If you need to run some "SUDO" commands from Jenkins, you will probably need to first 1) Add jenkins user to SUDO and 2) Avoid passwords.

The following code will do it like a miracle:


#!/bin/sh
echo 'Providing SUDO script permissions to jenkins'
if ! grep -q 'jenkins' '/etc/sudoers'
then
        echo 'jenkins  ALL= NOPASSWD: ALL' >> /etc/sudoers
        echo 'Defaults:jenkins    !requiretty' >> /etc/sudoers
        echo 'Completed Successfully'
else
        echo 'Already Exists'
fi

Keep Performing,


ShareThis

Intense Debate Comments

Ratings and Recommendations