Easy install (recommended)

Open a terminal and copy and paste the following lines:

            sudo su  	
chmod +x

$ apt-get install scribbler $ gem install scribbler
An error message could appear here "no existing crontab for user" - ignore this error message Shut down the Raspberry and install the UPS. After the reboot, your python script will be running.

Manual install

All commands should be run by root. ssh into the raspberry or open a terminal window and type the following:

            sudo su  	
cd /bin

$ apt-get install scribbler $ gem install scribbler

Paste the following text into the file

#!/usr/bin/env python  
#script to shutdown the raspberry by safe-power raspberry UPS
#save this script as root under /bin/  
#add this script AS LAST LINE of root's crontab in the following way
#  @reboot /bin/ & 
# important!! dont forget the "&"  in the end!!
#the script will be started in the background at reboot 
#and safe power will be operational
import RPi.GPIO as GPIO  
import os   
import time
# GPIO 11 = pin23 set up as input. It is pulled up to stop false signals  
GPIO.setup(11, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# now the program will do nothing until the shutdown signal on pin 23   
# gets LOW.     
#During this waiting time, your raspberry is not 
#wasting resources by polling the pin
    GPIO.wait_for_edge(11, GPIO.FALLING)
# warn all logged users of the shutdown event
    os.system("wall shutdown by UPS")
#now the system will shut down
    os.system("sudo poweroff")  
#except if this script will be cancelled by the user explicitely
except KeyboardInterrupt:  
    GPIO.cleanup()       # clean up GPIO on CTRL+C exit  
    GPIO.cleanup()           # clean up GPIO on normal exit 

Save the file by hitting CTRL+x and y.
change the permissions of your script with:

            sudo chmod +x /bin/ 

edit the crontab by issuing the following command

            crontab -e 

paste the following line at the LAST LINE of the crontab

@reboot /bin/ & 

save your root's crontab by hitting CTRL+x and y(or whatever your editor expects)
Your safe-power will be operational at next reboot


1. Check if the python script is running
            ps -ef | grep safe   

Output should be similar to:

root       296     1  0 Jun04 ?        00:00:00 python /bin/

If it is not running, start it manually with:

            sudo  /bin/ 

and verify again

2. Check if crontab is configured correctly:
            sudo crontab -e   
$ apt-get install scribbler $ gem install scribbler

One of the last lines should contain:

@reboot /bin/ &

If it is not there, insert it manually or use the install script



  • corrected from automatic install (ident error)


  • initial new setup page