Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions jobs/syslog_forwarder/templates/pre-start.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ chmod 0644 /etc/rsyslog.d/40-syslog-release-file-exclusion.conf

<% end %>

# Restart rsyslog: try systemctl first; if it fails (e.g., systemctl missing,
# service not managed by systemd, or VM partially stopped), fall back to
# the traditional service command. This ensures rsyslog starts reliably
# Restart rsyslog: try service first; if it fails (e.g., service missing,
# or VM partially stopped), fall back to systemctl. This ensures rsyslog starts reliably.
# across BOSH Lite, stopped VMs, or environments with partial systemd support.
echo "Restarting rsyslog..."
systemctl restart rsyslog 2>/dev/null || {
echo "systemctl restart failed, falling back to service..."
service rsyslog restart || echo "fallback restart also failed."
}
service rsyslog restart 2>/dev/null || {
echo "service restart failed, falling back to systemctl..."
systemctl restart rsyslog || echo "fallback restart also failed."
}
11 changes: 5 additions & 6 deletions jobs/syslog_storer/templates/pre-start.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ if [ -d "/etc/apparmor.d/rsyslog.d/" ]; then
fi
fi

# Restart rsyslog: try systemctl first; if it fails (e.g., systemctl missing,
# service not managed by systemd, or VM partially stopped), fall back to
# the traditional service command. This ensures rsyslog starts reliably
# Restart rsyslog: try service first; if it fails (e.g., service missing,
# or VM partially stopped), fall back to systemctl. This ensures rsyslog starts reliably.
# across BOSH Lite, stopped VMs, or environments with partial systemd support.
echo "Restarting rsyslog..."
systemctl restart rsyslog 2>/dev/null || {
echo "systemctl restart failed, falling back to service..."
service rsyslog restart || echo "fallback restart also failed."
service rsyslog restart 2>/dev/null || {
echo "service restart failed, falling back to systemctl..."
systemctl restart rsyslog || echo "fallback restart also failed."
}