How can ı detect just plug out the power cable on iris board use colibri imx6 computer on module?

I want to detect just plug out the power cable on iris board use shell script. which gpio will I control ?

when ı detect plug out the power cable ı want to make some job but firstly ı can detect.

thank you so much for replies …

Hi

There is no brown out detection circuit on any of our carrier boards.
So what you want to do is not possible. You would have to add hardware which detects a power interruption and which will signal this on any free GPIO to the module.

Max

hi,
I want to call a custom bash script when colibri shut down or start up or plug out the power cable.

here is my bash script name of initmodem

#! /bin/sh
# /etc/init.d/initmodem
#

# Some things that run always
touch /home/root/initmodem.txt

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script initmodem"
    echo "start case ">> /home/root/initmodem.txt
	pon gprs
    ;;;
  stop)
    echo "Stopping script initmodem"
    echo "stop case ">> /home/root/initmodem.txt
	poff gprs
    ;;;
  *)
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1
    ;;
esac

exit 0

path of this script “/etc/init.d/initmodem”

I want to start service so ı write this command

> update-rc.d initmodem defaults 91

Now ı plug out the power cable than
plug in system reboot

ı look the initmodem.txt file just write a " start case"

but ı will wait

stop case

start case

this case this is not work.

I try reboot system from console

this time its work perfect.

ı see this lines in initmodem.txt

stop case

start case

how can ı fix this problem ? ı must call “poff gprs” command before shut down or plug out the power cable or restarting any reason …