AnsweredAssumed Answered

How to call Script Upon Power Loss

Question asked by mikeo'neil on Oct 5, 2018
Latest reply on Oct 13, 2018 by APIcoder

UPS - FMS Shutdown Script

 

What I need is a way to call this script upon power loss?

 

I have a sh script that Closes FMS (17) upon activation. What I need is a way to call this script upon power loss. I will have a UPS for a Mac Mini running FMS 17. 

 

I have been in contact with APC and they advised there is no interface to customize for Mac OS X.

 

I need some advice from someone who has a script that detects when the computer is being powered by the UPS Battery. A sample would be even better on how to do this. Thanks-Mike

 

Full Script Attached:

 

Script:

 

#!/bin/sh

 

# Close Files and log to CloseFMS.txt

 

  fmsadmin -u user -p password CLOSE -y    > CloseFMS

 

  echo $? Error

 

# TimeStamp Function

 

  file_name=CloseFMS

  current_time=$(date "+%Y.%m.%d-%H.%M.%S")

  echo "Current Time : $current_time"

 

  new_fileName=$file_name.$current_time.txt

  echo "New FileName: " "$new_fileName"

 

  mv $file_name $new_fileName

  echo "You should see new file generated with timestamp on it.."

 

  echo $? Error

Attachments

Outcomes