#!/bin/sh -eu # wanttoquitsoon -- ask if to hang up before "another coin drops" # Copyright : GNU General Public License # Author : Dan Jacobson -- http://jidanni.org/comp/ppp/ # Created On : Tue Oct 30 10:05:48 2001 # Last Modified On: Sat Jan 14 05:37:07 2006 # Update Count : 118 # The phone company where I live charges in 5 minute intervals in the # day, 10 at night. A 19 minute call costs as much as a 16 minute # call. Therefore, it would be nice to have a program to remind me # about a minute before "my next coin will drop into their coffer" as # I want to get the most out of my connection before having to pay # more. I use free ISPs, so no need to measure any other items. if test $# -ne 2 -o X"$1" = X--help then cat 1>&2 <&1; exit 9;} test "X$2" != Xroot || { echo $0: Invoked as root etc. When I run X windows \ as a regular user root can\'t write to it. 2>&1; exit 29;} eval XAUTHORITY=~$2/.Xauthority test -r $XAUTHORITY || { echo $0: Can\'t read \$XAUTHORITY 2>&1; exit 59;} pidfile=/var/run/ppp0.pid started_ppp_time=`date +%T` SECONDS=$warning_period #use bash's dynamic $SECONDS : ${DISPLAY=:0.0}; export DISPLAY XAUTHORITY; sleep $(($1-$SECONDS)) while test -f $pidfile; do #check if same file upon close together calls? ( SECONDS=7 answer_before_time=`date +%T -dnow+$(($warning_period-$SECONDS))seconds` set +e; xmessage -file - -timeout $(($warning_period-$SECONDS)) \ -buttons "DON'T hang up":0,"HANG UP soon":11 <