Lines Matching +full:pre +full:- +full:timeout

1 #!/bin/bash -e
3 set -euo pipefail
9 USAGE="Usage: obmcutil [-h] [--wait] [--verbose] [--id=<INSTANCE_ID>]
20 HOST_TIMEOUT_TARGET=obmc-host-timeout@0.target
21 HOST_CRASH_TARGET=obmc-host-crash@0.target
36 # continuing on with the program or reporting an error if timeout reached.
62 echo "obmcutil recoveryoff Disable handling boot watchdog timeout and host crash"
65 echo "obmcutil recoveryon Enable handling boot watchdog timeout and host crash"
68 … echo "obmcutil recoverystatus Display the status of handling boot watchdog timeout and host crash"
74 echo "obmcutil listlogs List all phosphor-logging entries on the"
80 echo "obmcutil deletelogs Delete all phosphor-logging entries from"
86 echo " -h, --help show this help message and exit"
87 echo " -w, --wait block until state transition succeeds or fails"
88 echo " -v, --verbose print the journal to stdout if --wait is supplied"
89 echo " -i, -id instance id, default 0"
90 echo " -f, --force force issuing the command ignoring preconditions (use with caution)"
96 local timeout="$1"; shift
100 if [ -n "$G_VERBOSE" ]; then
101 journalctl -f &
109 # a timeout period.
111 while ! grep -q "$G_REQUESTED_STATE" <<< "$(handle_cmd "$G_QUERY")" ; do
117 # Could be bad if process is killed before 'timeout' occurs if
119 trap -- "" SIGTERM
121 # Workaround for lack of 'timeout' command.
123 sleep "$timeout"
129 "within timeout period (${timeout}s)"
132 if [ -n "$verbose_child" ]; then
141 if [ -n "$G_WAIT" ]; then
150 run_cmd busctl set-property "$@"
156 run_cmd busctl get-property "$@"
162 state=$(get_property "$@" | cut -d '"' -f2)
163 printf "%-20s: %s\n" "$4" "$state"
188 enabled_state=$(systemctl is-enabled "$target")
195 file="reboot-guard.conf"
199 mkdir -p "${dir}${unit}.target.d"
200 echo -e "[Unit]\nRefuseManualStart=yes" >> "${dir}${unit}.target.d/${file}"
207 file="reboot-guard.conf"
211 rm -rf "${dir}${unit}.target.d/${file}"
212 rm -rf "${dir}${unit}.target.d"
219 file="reboot-guard.conf"
224 if [ -e "${dir}${unit}.target.d/${file}" ]; then
236 SERVICE=$(mapper get-service "$OBJECT")
289 # If user has --force enabled, no check
290 if [ -n "$G_FORCE" ]; then
295 SERVICE=$(mapper get-service "$OBJECT")
298 state=$(get_property "$SERVICE" "$OBJECT" "$INTERFACE $PROPERTY" | cut -d '"' -f2)
300 echo "Chassis is $state, request rejected, use --force to override"
305 SERVICE=$(mapper get-service "$OBJECT")
308 state=$(get_property "$SERVICE" "$OBJECT" "$INTERFACE $PROPERTY" | cut -d '"' -f2)
310 echo "Host is $state, request rejected, use --force to override"
319 if [ -n "$blockingErrors" ]; then
327 # list all phosphor-logging entries
332 busctl -j call xyz.openbmc_project.ObjectMapper \
342 busctl -j call xyz.openbmc_project.Logging \
348 # delete all phosphor-logging entries
360 obmc-chassis-powered-off@0.target \
361 obmc-host-stop-pre@0.target \
362 obmc-host-stopped@0.target \
363 obmc-host-stopping@0.target \
364 obmc-power-off@0.target \
365 obmc-power-stop-pre@0.target \
366 obmc-power-stop@0.target
375 SERVICE=$(mapper get-service "$OBJECT")
387 SERVICE=$(mapper get-service "$OBJECT")
398 SERVICE=$(mapper get-service "$OBJECT")
410 SERVICE=$(mapper get-service "$OBJECT")
420 SERVICE=$(mapper get-service $OBJECT)
427 SERVICE=$(mapper get-service "$OBJECT")
434 SERVICE=$(mapper get-service "$OBJECT")
441 SERVICE=$(mapper get-service "$OBJECT")
455 SERVICE=$(mapper get-service "$OBJECT")
462 SERVICE=$(mapper get-service $OBJECT)
478 SERVICE=$(mapper get-service "$OBJECT")
486 SERVICE=$(mapper get-service "$OBJECT")
494 SERVICE=$(mapper get-service "$OBJECT")
555 declare -A status
559 printf " %-11s: %s\n" "hostReboot" "${status[$host_reboot_status]}"
560 printf " %-11s: %s\n" "bmcReboot" "${status[$bmc_reboot_status]}"
561 printf " %-11s: %s\n" "hostTimeout" "${status[$host_timeout_status]}"
562 printf " %-11s: %s\n" "hostCrash" "${status[$host_crash_status]}"
566 if [ -z "$blockingErrors" ]; then
593 -w|--wait)
598 -h|--help)
601 -v|--verbose)
605 -i=*|--id=*)
609 -f|--force)
613 -*)