#!/bin/sh ### BEGIN INIT INFO # Provides: raspi-rtc-power # Required-Start: kmod # Required-Stop: halt # X-Stop-After: networking # Default-Start: S # Default-Stop: 0 # Short-Description: on/off Raspi-RTC-Power # Description: switching on/off power via RTC chip on Rasp Pi extension board ### END INIT INFO set -e . /lib/lsb/init-functions ALARM=0; I2CBUS=0; if [ -r /etc/default/rtc ]; then . /etc/default/rtc fi if [ -r /etc/wakealarm ]; then ALARM=$(cat /etc/wakealarm) fi case "${1:-}" in start) log_action_begin_msg "Switching on RasPi-RTC-Power " modprobe i2c-dev i2cset -f -y $I2CBUS 0x6f 0x07 0x00 ES=$? log_action_end_msg $ES ;; stop) log_action_begin_msg "Switching off RasPi-RTC-Power " /sbin/rtc-power $I2CBUS $ALARM ES=$? log_action_end_msg $ES ;; *) echo "Usage: ${0:-} {start|stop}" >&2 exit 1 ;; esac