Skip to content

Commit 5bdce71

Browse files
committed
fix(postinstall): add error handling for systemctl commands
1 parent 8c964f8 commit 5bdce71

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

distributions/otelcol-contrib/postinstall.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# limitations under the License.
1616

1717
if command -v systemctl >/dev/null 2>&1; then
18-
systemctl daemon-reload
18+
systemctl daemon-reload || :
1919
systemctl enable otelcol-contrib.service
2020
if [ -f /etc/otelcol-contrib/config.yaml ]; then
21-
systemctl restart otelcol-contrib.service
21+
systemctl restart otelcol-contrib.service || :
2222
fi
2323
fi

distributions/otelcol-otlp/postinstall.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
# limitations under the License.
1616

1717
if command -v systemctl >/dev/null 2>&1; then
18-
systemctl daemon-reload
18+
systemctl daemon-reload || :
1919
systemctl enable otelcol-otlp.service
2020
if [ -f /etc/otelcol-otlp/config.yaml ]; then
21-
systemctl restart otelcol-otlp.service
21+
systemctl restart otelcol-otlp.service || :
2222
else
2323
echo "Make sure to configure otelcol-otlp by creating /etc/otelcol-otlp/config.yaml"
2424
fi

distributions/otelcol/postinstall.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# limitations under the License.
1616

1717
if command -v systemctl >/dev/null 2>&1; then
18-
systemctl daemon-reload
18+
systemctl daemon-reload || :
1919
systemctl enable otelcol.service
2020
if [ -f /etc/otelcol/config.yaml ]; then
21-
systemctl restart otelcol.service
21+
systemctl restart otelcol.service || :
2222
fi
2323
fi

0 commit comments

Comments
 (0)