Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6914 dpurdie 1
# buildtool - Upstart job file for the VIX buildtool
2
 
3
description "JATS Build Daemon"
4
author "dpurdie"
5
 
6
# When to start the service
7
start on runlevel [2345]
8
 
9
# When to stop the service
10
stop on runlevel [016]
11
 
12
# Automatically restart process if crashed
13
respawn
14
 
15
# Essentially lets upstart know the process will detach itself to the background
16
#expect fork
17
 
18
# Specify the user
19
setuid buildadm
20
setgid ccperdev
21
env USER=buildadm
22
env HOME=/home/buildadm
23
 
24
# Start the process
25
# Uses sh, not bash or anything fancy
26
# Run with '-e' - exit immediately if any untested command fails
27
script
28
    # Rotate startup log files
29
    LOGFILE=/tmp/buildtool
30
    if [ -f $LOGFILE ] ; then
31
        for ii in 9 8 7 6 5 4 3 2 ; do
32
            last=$( expr $ii - 1 )
33
            [ -f $LOGFILE.$ii ]   && rm $LOGFILE.$ii
34
            [ -f $LOGFILE.$last ] && mv $LOGFILE.$last $LOGFILE.$ii
35
        done
36
        mv $LOGFILE $LOGFILE.1
37
    fi
38
 
39
    exec 2>$LOGFILE 1>&2
40
    echo $(date) ' -- Starting buildtool'
41
    . /etc/profile
42
    unset GBE_PLATFORM
43
    #jats vars -v
44
    jats -NoExportVars eprog /work/buildtool/abtlaunch || true
45
    echo $(date) ' -- Sleep 30 seconds before restarting'
46
    sleep 30
47
end script
48