21 lines
631 B
Bash
21 lines
631 B
Bash
#!/bin/sh
|
|
# Recover a native Oracle Cloud Agent service without installing packages.
|
|
set -eu
|
|
|
|
unit=oracle-cloud-agent.service
|
|
load_state=$(systemctl show "$unit" --property=LoadState --value 2>/dev/null || true)
|
|
if [ "$load_state" != loaded ]; then
|
|
echo "Oracle Cloud Agent native service is absent; automatic restart is unavailable." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if systemctl is-active --quiet "$unit"; then
|
|
echo "Oracle Cloud Agent native service is active."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Oracle Cloud Agent native service is inactive; attempting restart."
|
|
systemctl reset-failed "$unit"
|
|
systemctl start "$unit"
|
|
systemctl is-active --quiet "$unit"
|