Skip to content

Commit cf8508d

Browse files
wieso-itziwieso-itzipeterzhuamazon
authored
Automatic Service Restart (Debian) (#4530)
Signed-off-by: wieso-itzi <wieso-itzi@github.local> Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Co-authored-by: wieso-itzi <wieso-itzi@github.local> Co-authored-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent b639507 commit cf8508d

File tree

2 files changed

+38
-16
lines changed
  • scripts/pkg/build_templates/current

2 files changed

+38
-16
lines changed

scripts/pkg/build_templates/current/opensearch-dashboards/deb/debian/postinst

+15-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,21 @@ if command -v systemd-tmpfiles > /dev/null; then
2929
systemd-tmpfiles --create opensearch-dashboards.conf
3030
fi
3131

32-
# Messages
33-
echo "### NOT starting on installation, please execute the following statements to configure opensearch-dashboards service to start automatically using systemd"
34-
echo " sudo systemctl daemon-reload"
35-
echo " sudo systemctl enable opensearch-dashboards.service"
36-
echo "### You can start opensearch-dashboards service by executing"
37-
echo " sudo systemctl start opensearch-dashboards.service"
32+
# Restart the service after an upgrade
33+
if [ "$1" = "configure" ] && [ -n "$2" ]; then
34+
if command -v systemctl >/dev/null && systemctl is-enabled opensearch-dashboards.service >/dev/null; then
35+
echo "Restarting opensearch-dashboards.service after upgrade"
36+
systemctl start opensearch-dashboards.service
37+
fi
38+
else
39+
# Messages
40+
echo "### NOT starting on installation, please execute the following statements to configure opensearch-dashboards service to start automatically using systemd"
41+
echo " sudo systemctl daemon-reload"
42+
echo " sudo systemctl enable opensearch-dashboards.service"
43+
echo "### You can start opensearch-dashboards service by executing"
44+
echo " sudo systemctl start opensearch-dashboards.service"
45+
fi
46+
3847
echo "### Upcoming breaking change in packaging"
3948
echo " In a future release of OpenSearch Dashboards, we plan to change the permissions associated with access to installed files"
4049
echo " If you are configuring tools that require read access to the OpenSearch Dashboards configuration files, we recommend you add the user that runs these tools to the 'opensearch-dashboards' group"

scripts/pkg/build_templates/current/opensearch/deb/debian/postinst

+23-10
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,30 @@ if command -v systemd-tmpfiles > /dev/null; then
6363
systemd-tmpfiles --create opensearch.conf
6464
fi
6565

66-
# Messages
67-
echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using systemd"
68-
echo " sudo systemctl daemon-reload"
69-
echo " sudo systemctl enable opensearch.service"
70-
echo "### You can start opensearch service by executing"
71-
echo " sudo systemctl start opensearch.service"
72-
73-
if [ -d ${product_dir}/plugins/opensearch-security ]; then
74-
echo "### Create opensearch demo certificates in ${config_dir}/"
75-
echo " See demo certs creation log in ${log_dir}/install_demo_configuration.log"
66+
# Restart the services after an upgrade
67+
if [ "$1" = "configure" ] && [ -n "$2" ]; then
68+
if command -v systemctl >/dev/null && systemctl is-enabled opensearch.service >/dev/null; then
69+
echo "Restarting opensearch.service after upgrade"
70+
systemctl start opensearch.service
71+
fi
72+
if command -v systemctl >/dev/null && systemctl is-enabled opensearch-performance-analyzer.service >/dev/null; then
73+
echo "Restarting opensearch-performance-analyzer.service after upgrade"
74+
systemctl start opensearch-performance-analyzer.service
75+
fi
76+
else
77+
# Messages
78+
echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using systemd"
79+
echo " sudo systemctl daemon-reload"
80+
echo " sudo systemctl enable opensearch.service"
81+
echo "### You can start opensearch service by executing"
82+
echo " sudo systemctl start opensearch.service"
83+
84+
if [ -d ${product_dir}/plugins/opensearch-security ]; then
85+
echo "### Create opensearch demo certificates in ${config_dir}/"
86+
echo " See demo certs creation log in ${log_dir}/install_demo_configuration.log"
87+
fi
7688
fi
89+
7790
echo "### Upcoming breaking change in packaging"
7891
echo " In a future release of OpenSearch, we plan to change the permissions associated with access to installed files"
7992
echo " If you are configuring tools that require read access to the OpenSearch configuration files, we recommend you add the user that runs these tools to the 'opensearch' group"

0 commit comments

Comments
 (0)