From 19ddce7834e3f847241db5ecf9dd68ee819b661f Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 7 Aug 2018 09:35:38 +0800 Subject: [PATCH] - make root dir clean. --- deploy/ansible.yml | 3 ++- deploy/cleanup.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 deploy/cleanup.sh diff --git a/deploy/ansible.yml b/deploy/ansible.yml index a0be3e6e6..2240ebfd4 100644 --- a/deploy/ansible.yml +++ b/deploy/ansible.yml @@ -2,6 +2,8 @@ - hosts: "{{ deploy_hosts }}" remote_user: ubuntu tasks: + - name: cleanup previous backup files + shell: cd /jxdata/jx-callback/deploy && ./cleanup.sh - name: copy execute file to dest copy: src: ../jx-callback @@ -17,6 +19,5 @@ owner: ubuntu group: ubuntu mode: 0555 - backup: yes - name: shell shell: cd /jxdata/jx-callback/conf && sed -i 's/runmode\s*=\s*.*/runmode = {{ runmode }}/' app.conf && sudo systemctl restart jx-callback diff --git a/deploy/cleanup.sh b/deploy/cleanup.sh new file mode 100755 index 000000000..49d6a345b --- /dev/null +++ b/deploy/cleanup.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [ ! -d "../backup" ]; then + mkdir ../backup +fi + +if [ -f "../jx-callback.*~" ] then + mv ../jx-callback.*~ ../backup/ +fi