diff options
author | Sven Gothel <[email protected]> | 2011-07-24 05:29:32 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-07-24 05:29:32 +0200 |
commit | e806800ac0a3e0bc3b855d6a430428f1984eff28 (patch) | |
tree | 4e628b41e6a30f22e51c4d195a56407e1dd02f03 /jenkins-server-slave-setup | |
parent | 477140f53cf387f09b1336630ed45bebad2b5ff8 (diff) |
Add jenkins server slave setup docs/scripts
Diffstat (limited to 'jenkins-server-slave-setup')
17 files changed, 649 insertions, 0 deletions
diff --git a/jenkins-server-slave-setup/cygwin-sshd/Cygwin-sshd.bat b/jenkins-server-slave-setup/cygwin-sshd/Cygwin-sshd.bat new file mode 100755 index 0000000..b6ddb51 --- /dev/null +++ b/jenkins-server-slave-setup/cygwin-sshd/Cygwin-sshd.bat @@ -0,0 +1,5 @@ +@echo off
+c:
+chdir c:\cygwin\bin
+bash --login -c /usr/sbin/sshd
+bash --login -c /usr/sbin/sshd
diff --git a/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_init.txt b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_init.txt new file mode 100644 index 0000000..252f5a2 --- /dev/null +++ b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_init.txt @@ -0,0 +1,87 @@ +cygwin_sshd_win7_init.txt +========================= + +I have read the following 2 howtos .. + [1] http://cygwin.com/faq/faq-nochunks.html#faq.using.sshd-in-domain + [2] http://www.kgx.net.nz/2010/03/cygwin-sshd-and-windows-7/ +where [2] was really helpfull. + +The following is based on [2] and we should be able to config it easily. + +Install Cygwin / OpenSSH - ssh daemon/service +============================================== + +In the following writing we will use single quotes +to quote names, ie 'sshd', or 'jogamp'. +The quotes are not part of the name, +but are ment to seperate the name from this text, +i.e. don't enter the quotes. + +1) Create accounts: + +- cmd.exe: 'lusrmgr' + - Users + - New User.. (right click) + - User Name: 'jogamp' + - Enter a password + - Uncheck: User must change password + - Check: Password never exires + - Right click on 'jogamp' -> properties (optional) + - MemberOf + - Add: 'Administrators' + + - Repeat this for account: 'cyg_server' ! (only for win7 service) + - Same options + + - Repeat this for account: 'sshd' ! (only for win7 service) + - Same options, _BUT_ don't add MemberOf 'Administrators' + +2) Enable account: Administrator (or use powershell) + +- cmd.exe: 'lusrmgr' + - enable Administrator + - set password for Administrator + +3) We need all these passwords, incl. Administrator !! +Please put them in a text file (user:password), ie c:\admin.txt + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +If you are not already run as user 'jogamp', +please: + - LOGOUT OF WINDOWS + - LOGIN TO WINDOWS AS USER 'jogamp' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +4) Install latest cygwin 1.7.5-1 as user 'jogamp' + - http://www.cygwin.com/ + - Answer: For All users + - Default location C:\cygwin + - Add: + - git + - openssh + - vim + - .. + - maybe: EVERYTHING but sources ! + +5) Update cygwin user mappings: + - Start cygwin shell as user 'jogamp' + - Run: + mkpasswd -l > /etc/passwd + mkgroup -l > /etc/group + +6) Add public keys to each users (Administrator, jogamp, ..) cygwin home ~/.ssh/authorized_keys: + - Start cygwin shell as user 'jogamp' + ++++++++++ + - mkdir /home/jogamp/.ssh + - cp authorized_keys /home/jogamp/.ssh + - chown -R jogamp /home/jogamp/.ssh + - chmod 0700 /home/jogamp/.ssh + - chmod 0600 /home/jogamp/.ssh/* + ++++++++++ + Repeat the above for account 'Administrator' as well! + +Now continue with either: + - cygwin_sshd_win7_service.txt + - cygwin_sshd_win7_usr_process.txt + diff --git a/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_service.txt b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_service.txt new file mode 100644 index 0000000..8487cb7 --- /dev/null +++ b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_service.txt @@ -0,0 +1,49 @@ +cygwin_sshd_win7_service.txt +============================== + +Please read cygwin_sshd_win7_init.txt first! + +7) Modify account settings for account 'cyg_server' _and_ +configure the ssh deamon, sshd: + - Start cygwin shell as Administrator: + - start cmd.exe + - runas /user:Administrator c:\cygwin\Cygwin.bat + + - 7.1) to configure account 'cyg_server' run the following commands + you might want to put it in a shell script, e.g. setup-cyg_server.sh + +++++++++ + editrights.exe -a SeAssignPrimaryTokenPrivilege -u cyg_server + editrights.exe -a SeCreateTokenPrivilege -u cyg_server + editrights.exe -a SeTcbPrivilege -u cyg_server + editrights.exe -a SeServiceLogonRight -u cyg_server + editrights.exe -l -u cyg_server + +++++++++ + + - 7.2) to configure sshd, run the following command: + ssh-host-config + + - Answer the followup questions as follows: + - Any 'overwrite file': yes (happens if you retry configuration) + - Should privilige seperation be used: yes + - Do you want to install sshd as a service: yes + - Enter the value of CYGWIN for the daemon: [] (nothing, just press return) + - Do you want to use a different user: no (using account: cyg_server) + - Enter the password for account cyg_server + + - 7.3) start sshd manually for the very first time: + + net start sshd + + sshd will be started automatically after each reboot! + + You can stop and uninstall the service via: + net stop sshd + cygrunsrv -R sshd + + To use the windows UI, launch: + - start: cmd.exe + - start: control admintools + + .. and click on services + + diff --git a/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_usr_process-setupusr.sh b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_usr_process-setupusr.sh new file mode 100644 index 0000000..a4ca501 --- /dev/null +++ b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_usr_process-setupusr.sh @@ -0,0 +1,5 @@ +editrights.exe -a SeAssignPrimaryTokenPrivilege -u jogamp +editrights.exe -a SeCreateTokenPrivilege -u jogamp +editrights.exe -a SeTcbPrivilege -u jogamp +editrights.exe -a SeServiceLogonRight -u jogamp +editrights.exe -l -u jogamp diff --git a/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_usr_process.txt b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_usr_process.txt new file mode 100644 index 0000000..766f782 --- /dev/null +++ b/jenkins-server-slave-setup/cygwin-sshd/cygwin_sshd_win7_usr_process.txt @@ -0,0 +1,73 @@ +cygwin_sshd_win7_usr_process.txt +================================= + +Please read cygwin_sshd_win7_init.txt first! + +7) Modify account settings for account 'jogamp' _and_ +configure the ssh deamon, sshd: + - Start cygwin shell as Administrator: + - start cmd.exe + - runas /user:Administrator c:\cygwin\Cygwin.bat + + - 7.1) to configure account 'jogamp' run the following commands + you might want to put it in a shell script, e.g. setup-jogamp.sh + +++++++++ + editrights.exe -a SeAssignPrimaryTokenPrivilege -u jogamp + editrights.exe -a SeCreateTokenPrivilege -u jogamp + editrights.exe -a SeTcbPrivilege -u jogamp + editrights.exe -a SeServiceLogonRight -u jogamp + editrights.exe -l -u jogamp + +++++++++ + + - 7.2) to configure sshd, run the following command: + ssh-host-config + + - Answer the followup questions as follows: + - Any 'overwrite file': yes (happens if you retry configuration) + - Should privilige seperation be used: no + - Do you want to install sshd as a service: no + + chown jogamp /etc/ssh* + +8) Autostart user 'jogamp' and user space sshd + + 8.1) Autostart sshd for user 'jogamp' + Create the sshd startup batch script 'Cygwin-sshd.bat' + in 'jogamp' home folder c:\Users\Jogamp + + ++++++++++ + @echo off + + C: + chdir C:\cygwin\bin + + bash --login -c /usr/sbin/sshd + ++++++++++ + + Create a shortcut to: + C:\Users\jogamp\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup + + 8.2) Automatic logon of 'jogamp' into windows-7 at boot + + http://www.windows7news.com/2009/02/01/automatic-logon-into-windows-7/ + + - start: cmd.exe + - start: control userpasswords2 + - Select the user account 'jogamp' in the main table + - Uncheck the “Users must enter a user name and password to use this computer. + - Click on the Apply button will open the Automatically Log On window. + - Enter the password and confirm it to add the password to the system + +9) Start sshd manually for the very first time: + +- Double-Click on your created (step 8.1) batch file 'Cygwin-sshd.bat' + +- You also need to manually connect to the service + to permit port access for this account! + A popup will appear. + So .. go on a diff machine and try: 'ssh -v jogamp@<IP-Address>' + +10) Restart Windows .. + +11) Try to login via SSH as user 'jogamp' + diff --git a/jenkins-server-slave-setup/git/.gitconfig b/jenkins-server-slave-setup/git/.gitconfig new file mode 100644 index 0000000..deba3dc --- /dev/null +++ b/jenkins-server-slave-setup/git/.gitconfig @@ -0,0 +1,6 @@ +[user] + name = JogAmp Build User\n + email = [email protected]\n + +[core] + autocrlf = false diff --git a/jenkins-server-slave-setup/git/.gitconfig2 b/jenkins-server-slave-setup/git/.gitconfig2 new file mode 100644 index 0000000..e6330f0 --- /dev/null +++ b/jenkins-server-slave-setup/git/.gitconfig2 @@ -0,0 +1,15 @@ +[url "http://github.com/"] + insteadOf = git://github.com/ + +[url "http://jogamp.org/git/"] + insteadOf = git://jogamp.org/srv/scm/ + +[url "http://jausoft.com/git/"] + insteadOf = git://jausoft.com/srv/scm/ + +[user] + name = JogAmp Build User\n + email = [email protected]\n + +[core] + autocrlf = false diff --git a/jenkins-server-slave-setup/macosx-vnc-access/Library/Preferences/com.apple.RemoteManagement.plist b/jenkins-server-slave-setup/macosx-vnc-access/Library/Preferences/com.apple.RemoteManagement.plist Binary files differnew file mode 100644 index 0000000..7c7779f --- /dev/null +++ b/jenkins-server-slave-setup/macosx-vnc-access/Library/Preferences/com.apple.RemoteManagement.plist diff --git a/jenkins-server-slave-setup/macosx-vnc-access/Library/Preferences/com.apple.VNCSettings.txt b/jenkins-server-slave-setup/macosx-vnc-access/Library/Preferences/com.apple.VNCSettings.txt new file mode 100644 index 0000000..5ffd9f2 --- /dev/null +++ b/jenkins-server-slave-setup/macosx-vnc-access/Library/Preferences/com.apple.VNCSettings.txt @@ -0,0 +1 @@ +64423400BFC2A497FF1C39567390ADCA diff --git a/jenkins-server-slave-setup/macosx-vnc-access/howto.txt b/jenkins-server-slave-setup/macosx-vnc-access/howto.txt new file mode 100644 index 0000000..07b022c --- /dev/null +++ b/jenkins-server-slave-setup/macosx-vnc-access/howto.txt @@ -0,0 +1,113 @@ +General Enable: + +$ echo -n enabled > /Library/Preferences/com.apple.ScreenSharing.launchd +$ echo -n enabled > /private/etc/ScreenSharing.launchd + +To disable screen sharing: + +$ cd /Library/Preferences +$ rm com.apple.ScreenSharing.launchd + +++++++++++++++ +++++++++++++++ + +Detailed RDP Enable with Password etc: + +Attention: Switch from RDP to ScreenSharing afterwards, since Auto Login seems not to be working with RDP ? - FIXME + +Hi all, + +I actually registered on this forum just to post this solution. I hope it will make many others happy! + +Motivation for going through these hoops: +I needed to access the desktop of an old OSX machine every now and then from a windows VNC client. Details of that machine are: +Dual G5 OSX 10.4 without monitor/keyboard. + +Important: + +- Remote Desktop had never been enabled before on that machine. +- SSH access however was available. + +So how do you turn on Apple Remote Desktop / VNC Server on a machine where it never ran before? That part was easy to find on the net: SSH as an admin user onto the OSX machine. Then execute this command: + +sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent + +Try to connect with your VNC client now. If it works, good, you're done. The above command takes care even of restarting the Remote Desktop Service when the computer is rebooted. + +But if you're not so lucky (like I was) and the connection fails with a message like: +- "Server did not offer supported security type" (tightVNC) +- "No matching security types" (realVNC) +- "Incompatible Version" (UltraVNC) + +you're stuck. What happened in this case is that the VNC password has never been setup properly. Follow these simple steps while still logged in as admin user to set up a default password ("pass" in our case): + +- Switch off RDP: +sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -stop + +- Go to the Preferences directory: +cd /Library/Preferences + +- edit the following files using vi (if you're not familiar with vi, be very careful to follow the instructions to the iota!): +sudo vi com.apple.RemoteManagement.plist + +Put the following lines into this file (hint: copy them from here rather than typing them). Instruction for vi newbies: +- copy the text below into your clipboard +- set focus to the ssh window +- press the 'i' key. This puts vi into text insert mode +- paste the text. If you're on windows/cygwin, click to top left of the cygwin ssh window -> Edit -> Paste +- press the 'Esc' key +- enter the keystrokes ':wq', colon tells vi you are about to enter a command, w is the command for write, q for quit. + +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"> +<dict> +<key>ARD_AllLocalUsers</key> +<false/> +<key>LoadRemoteManagementMenuExtra</key> +<true/> +<key>ScreenSharingReqPermEnabled</key> +<true/> +<key>VNCLegacyConnectionsEnabled</key> +<true/> +</dict> +</plist> + +- edit the file sudo vi com.apple.ScreenSharing.launchd +press the 'i' key and type enabled, hit return, 'Esc' and ':wq' + +- set the default VNC password to 'pass' by editing this file: +sudo vi com.apple.VNCSettings.txt +and copy/paste this string (the encoded password) into that file: 6755221D8BA8C5E2FF1C39567390ADCA + +- Now the files need to have their ownerships and access rights configured properly. Do this by executing the following commands after each other: + +sudo chmod 644 com.apple.RemoteManagement.plist +sudo chown root:admin com.apple.RemoteManagement.plist + +sudo chmod 644 com.apple.ScreenSharing.launchd +sudo chown root:admin com.apple.ScreenSharing.launchd + +sudo chmod 400 com.apple.VNCSettings.txt +sudo chown root:wheel com.apple.VNCSettings.txt + + +Now stop and start the Remote Desktop Server, or reboot the machine: + +To just restart the Remote Desktop first stop it: +sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -stop + +Then restart it: +sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent + +or, alternatively, reboot the server: + +sudo shutdown -r now + +Connect to the server and enter your password we set to "pass" above. Set the password to something else by opening the System Preferences -> Sharing -> Apple Remote Desktop -> Access Privileges and set the password in the "VNC viewers may control the screen with password:" to something else. + +:apple:ED + +Hope this helped! + +Cheers + +Balt Indermuehle <[email protected]> diff --git a/jenkins-server-slave-setup/scripts/backup_clean-archive.sh b/jenkins-server-slave-setup/scripts/backup_clean-archive.sh new file mode 100755 index 0000000..cffd04b --- /dev/null +++ b/jenkins-server-slave-setup/scripts/backup_clean-archive.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +bdir=$1 +shift + +echo TOTAL $bdir +du -hsc $bdir + +echo +echo Cleaning Archives $bdir +rm -rf `find $bdir -name archive` + +echo +echo Cleaned TOTAL $bdir +du -hsc $bdir + diff --git a/jenkins-server-slave-setup/scripts/backup_clean-workspace.sh b/jenkins-server-slave-setup/scripts/backup_clean-workspace.sh new file mode 100755 index 0000000..67b4e76 --- /dev/null +++ b/jenkins-server-slave-setup/scripts/backup_clean-workspace.sh @@ -0,0 +1,18 @@ +#! /bin/sh + +bdir=$1 +shift + +echo TOTAL $bdir +du -hsc $bdir + +echo +echo Cleaning workspace $bdir +rm -rf `find $bdir -name workspace` +rm -rf `find $bdir -name workspace-files` +rm -rf `find $bdir -name javadoc` + +echo +echo Cleaned TOTAL $bdir +du -hsc $bdir + diff --git a/jenkins-server-slave-setup/scripts/jenkins-initd-ubuntu b/jenkins-server-slave-setup/scripts/jenkins-initd-ubuntu new file mode 100755 index 0000000..cf0d9f4 --- /dev/null +++ b/jenkins-server-slave-setup/scripts/jenkins-initd-ubuntu @@ -0,0 +1,167 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: jenkins +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: S 0 1 6 +# Short-Description: Jenkins initscript +# Description: Jenkins Continuous Integration System +### END INIT INFO + +# Author: Luis Alves <luis DOT alves AT lafaspot DOT com> + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/usr/sbin:/usr/bin:/sbin:/bin +JENKINS_HOME=/srv/jenkins +#LOG="$JENKINS_HOME/log/jenkins.log" +DESC="Jenkins Continous Build Integration" +CHUID="jenkins:jenkins" +NAME=jenkins +DAEMON="/usr/bin/java" +DAEMON_ARGS="-jar "$JENKINS_HOME/jenkins.war" --httpPort=8080 --prefix=/chuck" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +export JENKINS_HOME + +# Exit if the package is not installed +# [ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +[ -f /etc/default/rcS ] && . /etc/default/rcS + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + + +pid_of_jenkins() { + cat "$PIDFILE" +} + +# +# Function that starts the daemon/service +# +do_start() +{ + #[ -e "$LOG" ] && cnt=`wc -l "$LOG" | awk '{ print $1 }'` || cnt=1 + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $DAEMON --chuid $CHUID -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. + #while { pid_of_jenkins > /dev/null ; } && + # ! { tail +$cnt "$LOG" | grep -q 'Winstone Servlet Engine .* running' ; } ; do + # sleep 1 + #done + +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: + diff --git a/jenkins-server-slave-setup/scripts/jenkins-start-rh b/jenkins-server-slave-setup/scripts/jenkins-start-rh new file mode 100755 index 0000000..ddeb1e2 --- /dev/null +++ b/jenkins-server-slave-setup/scripts/jenkins-start-rh @@ -0,0 +1,74 @@ +#! /bin/bash +# +# jenkins Start/Stop the Jenkins Continuous Integration server. +# +# chkconfig: 345 91 10 +# description: Jenkins is a Continuous Integration server. \ +# processname: jenkins +# pidfile: /var/run/jenkins.pid + + +# Source function library. +. /etc/rc.d/init.d/functions + +# Get config. +. /etc/sysconfig/network + +# Check that networking is up. +[ "${NETWORKING}" = "no" ] && exit 0 + +JENKINS_USER=jogl +JENKINS_HOME=/srv/jenkins +startup=$JENKINS_HOME/scripts/start.jenkins.sh +shutdown=$JENKINS_HOME/scripts/stop.jenkins.sh +export JAVA_HOME=/opt-linux-x86_64/j2se6 + +start(){ + echo -n $"Starting Jenkins service: " + su - $JENKINS_USER -c $startup + RETVAL=$? + echo +} + +stop(){ + action $"Stopping Jenkins service: " + su - $JENKINS_USER -c $shutdown + RETVAL=$? + echo +} + +status(){ + numproc=`ps -ef | grep jenkins.war | grep -v "grep jenkins.war" | wc -l` + if [ $numproc -gt 0 ]; then + echo "Jenkins is running..." + else + echo "Jenkins is stopped..." + fi +} + +restart(){ + stop + start +} + + +# See how we were called. +case "$1" in +start) + start + ;; +stop) + stop + ;; +status) + status + ;; +restart) + restart + ;; +*) + echo $"Usage: $0 {start|stop|status|restart}" + exit 1 +esac + +exit 0 diff --git a/jenkins-server-slave-setup/scripts/start.jenkins.sh b/jenkins-server-slave-setup/scripts/start.jenkins.sh new file mode 100755 index 0000000..cd5187b --- /dev/null +++ b/jenkins-server-slave-setup/scripts/start.jenkins.sh @@ -0,0 +1,7 @@ +#!/bin/bash +export JENKINS_HOME=/srv/jenkins +export JENKINS_WAR=$JENKINS_HOME/jenkins.war +export JENKINS_LOG=$JENKINS_HOME/jenkins.log +JAVA=$JAVA_HOME/bin/java +nohup nice $JAVA -jar $JENKINS_WAR --httpPort=8080 --prefix=/chuck > $JENKINS_LOG 2>&1 & + diff --git a/jenkins-server-slave-setup/scripts/starthudson.sh b/jenkins-server-slave-setup/scripts/starthudson.sh new file mode 100755 index 0000000..47fcac9 --- /dev/null +++ b/jenkins-server-slave-setup/scripts/starthudson.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +FLAGS="-server -Xms256m -Xmx512m -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops" +HUDSON_HOME=/srv/hudson/config +export HUDSON_HOME + +. /opt-linux-x86_64/etc/profile.jre6 +. /opt-share/etc/profile.ant + +/opt-linux-x86_64/jre6/bin/java ${FLAGS} -jar /srv/hudson/hudson.war 2>&1 | tee hudson.log diff --git a/jenkins-server-slave-setup/scripts/stop.jenkins.sh b/jenkins-server-slave-setup/scripts/stop.jenkins.sh new file mode 100755 index 0000000..fbf8454 --- /dev/null +++ b/jenkins-server-slave-setup/scripts/stop.jenkins.sh @@ -0,0 +1,3 @@ +#!/bin/bash +kill `ps -ef | grep jenkins.war | grep -v grep | awk '{ print $2 }'` + |