1*2d38ad5aSMatt Spinler#!/bin/bash
2*2d38ad5aSMatt Spinler#
3*2d38ad5aSMatt Spinler# config: 2 20
4*2d38ad5aSMatt Spinler# @brief: Get the fan monitor dump
5*2d38ad5aSMatt Spinler#
6*2d38ad5aSMatt Spinler
7*2d38ad5aSMatt Spinler. $DREPORT_INCLUDE/functions
8*2d38ad5aSMatt Spinler
9*2d38ad5aSMatt Spinlerif [ ! -e "/usr/bin/phosphor-fan-monitor" ]; then
10*2d38ad5aSMatt Spinler  exit 0
11*2d38ad5aSMatt Spinlerfi
12*2d38ad5aSMatt Spinler
13*2d38ad5aSMatt Spinlerfile_name="/tmp/fan_monitor_dump.json"
14*2d38ad5aSMatt Spinler
15*2d38ad5aSMatt Spinlerrm -f $file_name
16*2d38ad5aSMatt Spinlerkillall -s SIGUSR1 phosphor-fan-monitor
17*2d38ad5aSMatt Spinler
18*2d38ad5aSMatt Spinlerseconds=0
19*2d38ad5aSMatt Spinlerwhile [ ! -e "$file_name" ]; do
20*2d38ad5aSMatt Spinler    seconds=$(( seconds + 1 ))
21*2d38ad5aSMatt Spinler    if [ $seconds -eq 5 ]; then
22*2d38ad5aSMatt Spinler        echo "Timed out waiting for fan monitor dump"
23*2d38ad5aSMatt Spinler        exit 0
24*2d38ad5aSMatt Spinler    fi
25*2d38ad5aSMatt Spinler    sleep 1
26*2d38ad5aSMatt Spinlerdone
27*2d38ad5aSMatt Spinler
28*2d38ad5aSMatt Spinlerdesc="fan monitor dump"
29*2d38ad5aSMatt Spinleradd_copy_file "$file_name" "$desc"
30*2d38ad5aSMatt Spinler
31*2d38ad5aSMatt Spinlerrm -rf /tmp/fan_monitor_dump.json
32