Skip to content

Commit e35d2d3

Browse files
authored
Restart agent on debian package upgrade (#1826)
1 parent 02dc7b0 commit e35d2d3

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

Tools/src/create_deb.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ mkdir -p ${BUILD_ROOT}/var/run/amazon
5252
ln -f -s /opt/aws/amazon-cloudwatch-agent/var ${BUILD_ROOT}/var/run/amazon/amazon-cloudwatch-agent
5353

5454
cp ${BUILD_SPACE}/packaging/debian/conffiles ${BUILD_ROOT}/
55+
cp ${BUILD_SPACE}/packaging/debian/postinst ${BUILD_ROOT}/
5556
cp ${BUILD_SPACE}/packaging/debian/preinst ${BUILD_ROOT}/
5657
cp ${BUILD_SPACE}/packaging/debian/prerm ${BUILD_ROOT}/
5758
cp ${BUILD_SPACE}/packaging/debian/debian-binary ${BUILD_ROOT}/
@@ -79,7 +80,7 @@ cd ${BUILD_ROOT}
7980
tar czf data.tar.gz opt etc usr var --owner=0 --group=0
8081
cd ~-
8182
cd ${BUILD_ROOT}
82-
tar czf control.tar.gz control conffiles preinst prerm --owner=0 --group=0
83+
tar czf control.tar.gz control conffiles postinst preinst prerm --owner=0 --group=0
8384
cd ~-
8485

8586
echo "Creating the debian package"

packaging/debian/postinst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: MIT
4+
5+
set -e
6+
7+
# restart agent after upgrade
8+
if [ "$1" = "configure" ]; then
9+
if [ -x /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl ]; then
10+
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a cond-restart
11+
fi
12+
fi
13+
14+
exit 0

0 commit comments

Comments
 (0)