Use CPONE user name for HIS LoginBuat

This commit is contained in:
2026-09-25 22:09:05 +07:00
parent 20ec75fbcf
commit 0d2044926e
22 changed files with 127 additions and 47 deletions

View File

@@ -63,10 +63,10 @@ if [[ "$requested_scope" == "user" ]]; then
elif [[ "$requested_scope" == "system" ]]; then
systemctl_cmd=(systemctl)
resolved_scope=system
elif systemctl --user show "$service" >/dev/null 2>&1; then
elif [[ "$(systemctl --user show "$service" -p LoadState --value 2>/dev/null || true)" == loaded ]]; then
systemctl_cmd=(systemctl --user)
resolved_scope=user
elif systemctl show "$service" >/dev/null 2>&1; then
elif [[ "$(systemctl show "$service" -p LoadState --value 2>/dev/null || true)" == loaded ]]; then
systemctl_cmd=(systemctl)
resolved_scope=system
else
@@ -172,9 +172,13 @@ fi
for attempt in {1..20}; do
if "${systemctl_cmd[@]}" is-active --quiet "$service"; then
new_pid="$("${systemctl_cmd[@]}" show "$service" -p MainPID --value 2>/dev/null || true)"
if [[ "$restart_mode" == "systemctl" || "$new_pid" != "$main_pid" ]]; then
echo "Service aktif: $service (MainPID=${new_pid:-unknown})"
exit 0
if [[ "$new_pid" =~ ^[1-9][0-9]*$ && ( "$restart_mode" == "systemctl" || "$new_pid" != "$main_pid" ) ]]; then
sleep 2
confirmed_pid="$("${systemctl_cmd[@]}" show "$service" -p MainPID --value 2>/dev/null || true)"
if [[ "$confirmed_pid" == "$new_pid" ]] && "${systemctl_cmd[@]}" is-active --quiet "$service"; then
echo "Service aktif: $service (MainPID=$confirmed_pid)"
exit 0
fi
fi
fi
sleep 1