forked from traccar/traccar-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
32 lines (32 loc) · 1020 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
node ('traccar') {
stage('Preparation') { // for display purposes
//git 'https://github.com/rodrigocastrillon/traccar-web.git'
git 'https://github.com/traccar/traccar-web'
}
stage('Stop Server') {
try {
def traccarPID = sh(script: "ps -ef|grep traccar|grep -v grep|awk '{ print \$2 }'", returnStdout: true)
sh "kill -9 ${traccarPID}"
} catch (e) {
echo "Traccar server is not running"
}
}
stage('Backup') {
if (fileExists('/opt/traccar/web')) {
sh 'mkdir -p /opt/traccar-web_backup/`date +"%d-%m-%Y"`'
sh 'cp -Rn /opt/traccar/web /opt/traccar-web_backup/`date +"%d-%m-%Y"`'
} else {
echo "Traccar not found"
}
}
stage('Deploy') {
sh "mkdir -p /opt/traccar/web"
sh "rm -Rf /opt/traccar/web/*"
sh "cp -R web/* /opt/traccar/web"
}
stage('Sart Server') {
dir('/opt/traccar') {
sh "java -jar tracker-server.jar traccar.xml &"
}
}
}