| | 35 | |
| | 36 | == Automating startup: Unix == |
| | 37 | |
| | 38 | The easiest way to make the client start up automatically is to use `cron`. Type `crontab -e`, and add this line to your crontab file: |
| | 39 | |
| | 40 | {{{ |
| | 41 | @reboot cd /buildbot/ghc && make start |
| | 42 | }}} |
| | 43 | |
| | 44 | Remember to change `/buildbot/ghc` to your buildbot directory. |
| | 45 | |
| | 46 | Cron will run the command in a minimal environment: it won't execute your normal shell startup files, so you won't have your usual `PATH` settings, for example. To get the right `PATH` and other environment variables, we suggest adding them to the `make start` rule in the `Makefile`. FOr example, my setup looks something like this: |
| | 47 | |
| | 48 | {{{ |
| | 49 | start: |
| | 50 | PATH=/usr/bin:/bin:/home/simonmar/bin \ |
| | 51 | http_proxy=http://157.58.63.38:80 \ |
| | 52 | twistd --no_save -y buildbot.tac |
| | 53 | }}} |
| | 54 | |
| | 55 | It might be a good idea to have the buildbot restarted once a day before your build is due to start, just in case it has died for any reason. I have another line in my crontab that looks like this: |
| | 56 | |
| | 57 | {{{ |
| | 58 | 0 17 * * * cd /64playpen/buildbot && (make stop; make start) |
| | 59 | }}} |
| | 60 | |
| | 61 | To restart the client at 17.00, before the builds start at 18.00. |
| | 62 | |
| | 63 | It's a good idea to test that running the client via a cron job actually works, so test it: setup a temporary cron job to start the client in a couple of minutes time, check that the client is up and running, and maybe force a build via the status page to check that the build environment is working. |
| | 64 | |
| | 65 | == Automating startup: Windows == |
| | 66 | |
| | 67 | I did it the following way. Create a script in `<buildbotdir>/restart.sh`: |
| | 68 | |
| | 69 | {{{ |
| | 70 | PATH=/bin:/usr/bin |
| | 71 | cd <buildbotdir> |
| | 72 | make stop |
| | 73 | make start |
| | 74 | }}} |
| | 75 | |
| | 76 | (don't forget to create the script as a Unix text file, not a DOS text file, otherwise strange things will probably happen, they did to me anyway). |
| | 77 | |
| | 78 | Create a new "Scheduled Task" via Control Panel->Scheduled Tasks. The command you want to run is |
| | 79 | |
| | 80 | {{{ |
| | 81 | c:\cygwin\bin\sh <buildbotdir>/restart.sh |
| | 82 | }}} |
| | 83 | |
| | 84 | Schedule the task to run (a) at startup and possibly also (b) once a day, before your build is due to start. You can add multiple schedulers for a task by checking the box at the bottom of the "Schedule" page of the scheduled task settings. |