grover66 / kidtimer

Script to manage computer usage by time and schedule.
18 stars 23 forks source link

problems running #1

Closed barpi closed 10 years ago

barpi commented 10 years ago

I followed instructions on Ubuntu 13.10. Installed and nothing happens when my children log on. I have two kids Izus and olcsi they don't have passwords.

my installed files: /etc/kidtimer/kid.list izus olcsi

/etc/cron.d/kidtimer 0 * * * * root /usr/local/bin/kidtimer hourly 0 0 * * * root /usr/local/bin/kidtimer daily

/usr/local/kidtimer/schedule/ izus

hour weekday weekend (y/n)

00 n n 01 n n 02 n n 03 n n 04 n n 05 n n 06 n n 07 n y 08 y y 09 y y 10 y y 11 y y 12 y y 13 y y 14 y y 15 y y 16 y y 17 y y 18 y y 19 y y 20 n n 21 n n 22 n n 23 n n

minutes weekday weekend

MAX 30 60

/usr/local/kidtimer/time/.ttl izus 3

/usr/local/bin/kidtimer

!/bin/bash

Restrict kids computer access to specific hours and total time.

By: Michael Groves - grover66_at_gmail_dot_com

variables

basedir="/usr/local/kidtimer" configdir="/etc/kidtimer" Cdate=/bin/date | awk '{ print $2" "$3 }' TUI=0 HOUR=/bin/date +%H DOW=/bin/date +%u WEEKEND="no" [ "$DOW" == "6" ] && WEEKEND="yes" [ "$DOW" == "7" ] && WEEKEND="yes"

arguments

[ $# -eq 0 ] && TUI=1 [ $# -eq 1 ] && COMMAND=$1 [ $# -eq 2 ] && COMMAND=$1 && KID=$2 [ $# -eq 3 ] && COMMAND=$1 && KID=$2 && Time=$3

Subroutines

go_check_install () { if [ ! -e $basedir ]; then go_initialize fi }

go_initialize () { /usr/bin/dpkg -l at >/dev/null if [ $? -eq 1 ]; then echo "Package:\"at\" is required. Please run;" echo "sudo apt-get install at" exit 1 fi /bin/mkdir -p $basedir/time /bin/mkdir -p $basedir/schedule /bin/cp $0 /usr/local/bin/kidtimer && chmod +x /usr/local/bin/kidtimer echo "0 * * * * root /usr/local/bin/kidtimer hourly" > /etc/cron.d/kidtimer echo "0 0 * * * root /usr/local/bin/kidtimer daily" >> /etc/cron.d/kidtimer echo "* * * * * root /usr/local/bin/kidtimer check" >> /etc/cron.d/kidtimer echo "@reboot root /usr/local/bin/kidtimer daily" >> /etc/cron.d/kidtimer echo "@reboot root /usr/local/bin/kidtimer hourly" >> /etc/cron.d/kidtimer /bin/mkdir $configdir /usr/bin/touch $configdir/kid.list go_create_message_files echo "Kidtimer is now installed. Run /usr/local/bin/kidtimer to configure." }

go_create_message_files () { cat << EOF > $basedir/send5.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 5 minutes."' \$Name EOF chmod +x $basedir/send5.sh cat << EOF > $basedir/send4.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 4 minutes."' \$Name EOF chmod +x $basedir/send4.sh cat << EOF > $basedir/send3.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 3 minutes."' \$Name EOF chmod +x $basedir/send3.sh cat << EOF > $basedir/send2.sh

!/bin/bash

Name=$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 2 minutes."' \$Name EOF chmod +x $basedir/send2.sh cat << EOF > $basedir/send1.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 1 minute."' \$Name EOF chmod +x $basedir/send1.sh cat << EOF > $basedir/logout.sh

!/bin/bash

Name=\$1 /usr/bin/pkill -KILL -u \$Name rm -rf /tmp/kidtimer.shutdown.\$Name EOF chmod +x $basedir/logout.sh cat << EOF > $basedir/schedule/blank

hour weekday weekend (y/n)

00 n n 01 n n 02 n n 03 n n 04 n n 05 n n 06 n n 07 n n 08 y y 09 y y 10 y y 11 y y 12 y y 13 y y 14 y y 15 y y 16 y y 17 y y 18 y y 19 y y 20 n n 21 n n 22 n n 23 n n

minutes weekday weekend

MAX 120 240 EOF }

go_check () { for I in cat $configdir/kid.list; do /usr/bin/users | grep -q $I if [ $? -eq 0 ]; then if [ -e $basedir/time/$I.ttl ]; then C=cat $basedir/time/$I.ttl C=$((C - 1)) echo $C > $basedir/time/$I.ttl else get_ttl_time echo $TIME_LIMIT > $basedir/time/$I.ttl C=$TIME_LIMIT fi else go_clean_jobs $I exit 0 fi

check time

    if [ $C -le 0 ]; then
            if [ ! -e /tmp/kidtimer.shutdown.$I ]; then
                    /usr/bin/passwd $I -l
                    go_logout $I
            fi
    fi

done }

get_ttl_time () { [ "$WEEKEND" == "no" ] && TIME_LIMIT=cat $basedir/schedule/$I | grep ^MAX | awk '{ print $2 }' [ "$WEEKEND" == "yes" ] && TIME_LIMIT=cat $basedir/schedule/$I | grep ^MAX | awk '{ print $3 }' }

go_clean_jobs () { K=$1 for I in /usr/bin/atq | awk '{ print $1 }' | sort; do /usr/bin/at -c $I | grep kidtimer | grep -q $K [ $? -eq 0 ] && /usr/bin/at -d $I done [ -e /tmp/kidtimer.shutdown.$K ] && rm -rf /tmp/kidtimer.shutdown.$K }

go_daily () { for I in cat $configdir/kid.list; do ls -l $basedir/time/$I.ttl | grep -q "$Cdate" if [ ! $? -eq 0 ]; then get_ttl_time echo $TIME_LIMIT > $basedir/time/$I.ttl fi done }

go_hourly () { if [ -s $configdir/kid.list ]; then for I in cat $configdir/kid.list; do if [ -e $basedir/schedule/$I ]; then [ -e $basedir/time/$I.ttl ] && C=cat $basedir/time/$I.ttl [ $C -eq 0 ] && /usr/bin/passwd $I -l && exit 0 [ "$WEEKEND" == "no" ] && R=grep ^$HOUR $basedir/schedule/$I | awk '{ print $2 }' [ "$WEEKEND" == "yes" ] && R=grep ^$HOUR $basedir/schedule/$I | awk '{ print $3 }' if [ "$R" == "y" ]; then /usr/bin/passwd $I -u else /usr/bin/passwd $I -l /usr/bin/users | grep -q $I && /usr/local/bin/kidtimer shutdown $I fi fi done fi }

go_logout () { K=$1 echo "$basedir/send5.sh $K" | at now + 1 minutes echo "$basedir/send4.sh $K" | at now + 2 minutes echo "$basedir/send3.sh $K" | at now + 3 minutes echo "$basedir/send2.sh $K" | at now + 4 minutes echo "$basedir/send1.sh $K" | at now + 5 minutes echo "$basedir/logout.sh $K" | at now + 6 minutes touch /tmp/kidtimer.shutdown.$K }

go_addtime () { U=$KID A=$Time if [ "$KID" == "reset" ]; then echo "0" > $basedir/time/$U.ttl echo "Done." exit 0 elif [ "$KID" == "" ]; then echo "Error." echo "Syntax: addtime <minutes|reset>" exit 1 else C=cat $basedir/time/$KID.ttl C=$((C + Time)) echo $C > $basedir/time/$KID.ttl get_time fi

/usr/bin/passwd $KID -u go_clean_jobs $KID }

get_time () { cat $basedir/time/$KID.ttl }

go_tui () { go_command_list echo -n "Choose: "; read -e X case "$X" in 1) go_setup_user ;; 2) go_modify_user ;; 3) go_remove_user ;; 4) go_list_users ;; 5) exit 0 ;; esac go_tui }

go_command_list () { echo echo "1) Setup user limits." echo "2) Modify user limits." echo "3) Remove user limits." echo "4) List configured users." echo "5) Quit." echo }

go_list_users () { echo echo "Users configured for kidtimer:" if [ -s $configdir/kid.list ]; then cat $configdir/kid.list else echo "No configured users." fi }

go_setup_user () { echo echo -n "Username: "; read -e U /usr/bin/id $U > /dev/null 2>&1 if [ $? -eq 0 ]; then /bin/cp $basedir/schedule/blank $basedir/schedule/$U echo "0" > $basedir/time/$U.ttl echo $U >> $configdir/kid.list echo "Done." echo echo -n "Modify limits now ?(y/n): "; read -e M if [ "$M" == "y" ]; then if [ -e /usr/bin/nano ]; then /usr/bin/nano $basedir/schedule/$U echo "Done." else /usr/bin/vi $basedir/schedule/$U echo "Done." fi fi else echo "Error. User does not exist. Please create user using the useradd command first." fi }

go_modify_user () { echo echo -n "Username: "; read -e U grep -q ^$U $configdir/kid.list if [ $? -eq 0 ]; then if [ -e /usr/bin/nano ]; then /usr/bin/nano $basedir/schedule/$U echo "Done." else /usr/bin/vi $basedir/schedule/$U echo "Done." fi else echo "Error. User not setup. Please setup user first." fi }

go_remove_user () { echo echo -n "Username: "; read -e U grep -q ^$U $configdir/kid.list if [ $? -eq 0 ]; then grep -v ^$U $configdir/kid.list > /tmp/kidtimer.tmp cat /tmp/kidtimer.tmp > $configdir/kid.list echo "Done." else echo "Error. User is not setup." fi }

get_update () { if [ -e /usr/bin/curl ]; then curl -o- https://raw.github.com/grover66/kidtimer/master/kidtimer > /usr/local/bin/kidtimer if [ $? -eq 0 ]; then echo "/usr/local/bin/kidtimer has been updated from http://github.com/grover66/kidtimer." else echo "Error. Download from http://github.com/grover66/kidtimer failed." fi else echo "Error. Curl is not installed. Please run;" echo "sudo apt-get install curl" fi }

go_help () { echo echo "Commands:" echo "--------------------------------------------------------------------------------" echo "addtime ... Increases allowed time for the day." echo "gettime ... Increases allowed time for the day." echo "logout ... Starts logout sequence for user." echo "hourly ... Enables/disables user access based on the schedule." echo "daily ... Resets time for the new day." echo "help ... This list." echo "--------------------------------------------------------------------------------" }

Code

go_check_install [ $TUI -eq 1 ] && go_tui

case "$COMMAND" in addtime) go_addtime ;; gettime) get_time ;; update) get_update ;; logout) go_logout $KID ;; initialize) go_initialize ;; hourly) go_hourly ;; daily) go_daily ;; check) go_check ;; -h) go_help ;; help) go_help ;; esac exit 0

my cron jobs: /etc/crontab: system-wide crontab

Unlike any other crontab you don't have to run the `crontab'

command to install the new version when you edit this file

and files in /etc/cron.d. These files also have username fields,

that none of the other crontabs do.

SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

m h dom mon dow user command

17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

grover66 commented 10 years ago

Barpi,

Thanks for emailing me with your question. You are the first! Anyway...

You say they don't have passwords? Does that mean you configured them to login without the need for a password or did you (as root) set their passwords to null?

Here is what should happen;

A cronjob, running every minute, from /etc/cron.d/kidtimer, will check to see if any of your defined users (in /etc/kidtimer/kid.list) are logged in. If so, it will increment that user's time by one minute (/usr/local/kidtimer/time/.ttl). It will also compare that value with their MAX time in /usr/local/kidtimer/schedule/. If their current total is equal to or greater than the MAX time for that weekday or weekend day, it will start a logoff sequence by creating 6 "at" jobs (view at that time by typing "atq"). Five of those "at" jobs just alert the user with a popup using /usr/bin/notify-send. The sixth uses the command pkill -u to force them off. At that point, their account is locked until the next day.

There is also a cronjob that runs every hour, checking /usr/local/kidtimer/schedule/. It either unlocks the account (with a "y") or locks the account and starts the logoff process (with a "n") for a logged in user.

Please let me know if this helps you understand how it works better. This may help me understand what is going wrong.

Thanks,

Mike :)

On Sat, Nov 23, 2013 at 5:38 AM, barpi notifications@github.com wrote:

I followed instructions on Ubuntu 13.10. Installed and nothing happens when my children log on. I have two kids Izus and olcsi they don't have passwords.

my installed files: /etc/kidtimer/kid.list izus olcsi

/etc/cron.d/kidtimer 0 * * * * root /usr/local/bin/kidtimer hourly 0 0 * * * root /usr/local/bin/kidtimer daily

  • * * * * root /usr/local/bin/kidtimer check @reboothttps://github.com/rebootroot /usr/local/bin/kidtimer daily @reboot https://github.com/reboot root /usr/local/bin/kidtimer hourly

/usr/local/kidtimer/schedule/ izus

hour weekday weekend (y/n)

00 n n 01 n n 02 n n 03 n n 04 n n 05 n n 06 n n 07 n y 08 y y 09 y y 10 y y 11 y y 12 y y 13 y y 14 y y 15 y y 16 y y 17 y y 18 y y 19 y y 20 n n 21 n n 22 n n 23 n n

minutes weekday weekend

MAX 30 60

/usr/local/kidtimer/time/.ttl izus 3

/usr/local/bin/kidtimer

!/bin/bash

Restrict kids computer access to specific hours and total time. By: Michael Groves - grover66_at_gmail_dot_com

variables

basedir="/usr/local/kidtimer" configdir="/etc/kidtimer" Cdate=/bin/date | awk '{ print $2" "$3 }' TUI=0 HOUR=/bin/date +%H DOW=/bin/date +%u WEEKEND="no" [ "$DOW" == "6" ] && WEEKEND="yes" [ "$DOW" == "7" ] && WEEKEND="yes"

arguments

[ $# -eq 0 ] && TUI=1 [ $# -eq 1 ] && COMMAND=$1 [ $# -eq 2 ] && COMMAND=$1 && KID=$2 [ $# -eq 3 ] && COMMAND=$1 && KID=$2 && Time=$3

################# Subroutines ################## ################################################

go_check_install () { if [ ! -e $basedir ]; then go_initialize fi }

go_initialize () { /usr/bin/dpkg -l at >/dev/null if [ $? -eq 1 ]; then echo "Package:\"at\" is required. Please run;" echo "sudo apt-get install at" exit 1 fi /bin/mkdir -p $basedir/time /bin/mkdir -p $basedir/schedule /bin/cp $0 /usr/local/bin/kidtimer && chmod +x /usr/local/bin/kidtimer echo "0 * * * * root /usr/local/bin/kidtimer hourly" > /etc/cron.d/kidtimer echo "0 0 * * * root /usr/local/bin/kidtimer daily" >> /etc/cron.d/kidtimer echo "* * * * * root /usr/local/bin/kidtimer check" >> /etc/cron.d/kidtimer echo "@reboot https://github.com/reboot root /usr/local/bin/kidtimer daily" >> /etc/cron.d/kidtimer echo "@reboot https://github.com/reboot root /usr/local/bin/kidtimer hourly" >> /etc/cron.d/kidtimer /bin/mkdir $configdir /usr/bin/touch $configdir/kid.list go_create_message_files echo "Kidtimer is now installed. Run /usr/local/bin/kidtimer to configure." }

go_create_message_files () { cat << EOF > $basedir/send5.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 5 minutes."' \$Name EOF chmod +x $basedir/send5.sh cat << EOF > $basedir/send4.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 4 minutes."' \$Name EOF chmod +x $basedir/send4.sh cat << EOF > $basedir/send3.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 3 minutes."' \$Name EOF chmod +x $basedir/send3.sh cat << EOF > $basedir/send2.sh

!/bin/bash

Name=$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 2 minutes."' \$Name EOF chmod +x $basedir/send2.sh cat << EOF > $basedir/send1.sh

!/bin/bash

Name=\$1 /bin/su -s /bin/bash -c 'DISPLAY=:0 /usr/bin/notify-send -i \ /usr/share/pixmaps/gnome-set-time.png "ALERT" \ "You will be logged out in 1 minute."' \$Name EOF chmod +x $basedir/send1.sh cat << EOF > $basedir/logout.sh

!/bin/bash

Name=\$1 /usr/bin/pkill -KILL -u \$Name rm -rf /tmp/kidtimer.shutdown.\$Name EOF chmod +x $basedir/logout.sh cat << EOF > $basedir/schedule/blank

hour weekday weekend (y/n)

00 n n 01 n n 02 n n 03 n n 04 n n 05 n n 06 n n 07 n n 08 y y 09 y y 10 y y 11 y y 12 y y 13 y y 14 y y 15 y y 16 y y 17 y y 18 y y 19 y y 20 n n 21 n n 22 n n 23 n n

minutes weekday weekend

MAX 120 240 EOF }

go_check () { for I in cat $configdir/kid.list; do /usr/bin/users | grep -q $I if [ $? -eq 0 ]; then if [ -e $basedir/time/$I.ttl ]; then C=cat $basedir/time/$I.ttl C=$((C - 1)) echo $C > $basedir/time/$I.ttl else get_ttl_time echo $TIME_LIMIT > $basedir/time/$I.ttl C=$TIME_LIMIT fi else go_clean_jobs $I exit 0 fi

check time

if [ $C -le 0 ]; then if [ ! -e /tmp/kidtimer.shutdown.$I ]; then /usr/bin/passwd $I -l go_logout $I fi fi done }

get_ttl_time () { [ "$WEEKEND" == "no" ] && TIME_LIMIT=cat $basedir/schedule/$I | grep ^MAX | awk '{ print $2 }' [ "$WEEKEND" == "yes" ] && TIME_LIMIT=cat $basedir/schedule/$I | grep ^MAX | awk '{ print $3 }' }

go_clean_jobs () { K=$1 for I in /usr/bin/atq | awk '{ print $1 }' | sort; do /usr/bin/at -c $I | grep kidtimer | grep -q $K [ $? -eq 0 ] && /usr/bin/at -d $I done [ -e /tmp/kidtimer.shutdown.$K ] && rm -rf /tmp/kidtimer.shutdown.$K }

go_daily () { for I in cat $configdir/kid.list; do ls -l $basedir/time/$I.ttl | grep -q "$Cdate" if [ ! $? -eq 0 ]; then get_ttl_time echo $TIME_LIMIT > $basedir/time/$I.ttl fi done }

go_hourly () { if [ -s $configdir/kid.list ]; then for I in cat $configdir/kid.list; do if [ -e $basedir/schedule/$I ]; then [ -e $basedir/time/$I.ttl ] && C=cat $basedir/time/$I.ttl [ $C -eq 0 ] && /usr/bin/passwd $I -l && exit 0 [ "$WEEKEND" == "no" ] && R=grep ^$HOUR $basedir/schedule/$I | awk '{ print $2 }' [ "$WEEKEND" == "yes" ] && R=grep ^$HOUR $basedir/schedule/$I | awk '{ print $3 }' if [ "$R" == "y" ]; then /usr/bin/passwd $I -u else /usr/bin/passwd $I -l /usr/bin/users | grep -q $I && /usr/local/bin/kidtimer shutdown $I fi fi done fi }

go_logout () { K=$1 echo "$basedir/send5.sh $K" | at now + 1 minutes echo "$basedir/send4.sh $K" | at now + 2 minutes echo "$basedir/send3.sh $K" | at now + 3 minutes echo "$basedir/send2.sh $K" | at now + 4 minutes echo "$basedir/send1.sh $K" | at now + 5 minutes echo "$basedir/logout.sh $K" | at now + 6 minutes touch /tmp/kidtimer.shutdown.$K }

go_addtime () { U=$KID A=$Time if [ "$KID" == "reset" ]; then echo "0" > $basedir/time/$U.ttl echo "Done." exit 0 elif [ "$KID" == "" ]; then echo "Error." echo "Syntax: addtime " exit 1 else C=cat $basedir/time/$KID.ttl C=$((C + Time)) echo $C > $basedir/time/$KID.ttl get_time fi

/usr/bin/passwd $KID -u go_clean_jobs $KID }

get_time () { cat $basedir/time/$KID.ttl }

go_tui () { go_command_list echo -n "Choose: "; read -e X case "$X" in 1) go_setup_user ;; 2) go_modify_user ;; 3) go_remove_user ;; 4) go_list_users ;; 5) exit 0 ;; esac go_tui }

go_command_list () { echo echo "1) Setup user limits." echo "2) Modify user limits." echo "3) Remove user limits." echo "4) List configured users." echo "5) Quit." echo }

go_list_users () { echo echo "Users configured for kidtimer:" if [ -s $configdir/kid.list ]; then cat $configdir/kid.list else echo "No configured users." fi }

go_setup_user () { echo echo -n "Username: "; read -e U /usr/bin/id $U > /dev/null 2>&1 if [ $? -eq 0 ]; then /bin/cp $basedir/schedule/blank $basedir/schedule/$U echo "0" > $basedir/time/$U.ttl echo $U >> $configdir/kid.list echo "Done." echo echo -n "Modify limits now ?(y/n): "; read -e M if [ "$M" == "y" ]; then if [ -e /usr/bin/nano ]; then /usr/bin/nano $basedir/schedule/$U echo "Done." else /usr/bin/vi $basedir/schedule/$U echo "Done." fi fi else echo "Error. User does not exist. Please create user using the useradd command first." fi }

go_modify_user () { echo echo -n "Username: "; read -e U grep -q ^$U $configdir/kid.list if [ $? -eq 0 ]; then if [ -e /usr/bin/nano ]; then /usr/bin/nano $basedir/schedule/$U echo "Done." else /usr/bin/vi $basedir/schedule/$U echo "Done." fi else echo "Error. User not setup. Please setup user first." fi }

go_remove_user () { echo echo -n "Username: "; read -e U grep -q ^$U $configdir/kid.list if [ $? -eq 0 ]; then grep -v ^$U $configdir/kid.list > /tmp/kidtimer.tmp cat /tmp/kidtimer.tmp > $configdir/kid.list echo "Done." else echo "Error. User is not setup." fi }

get_update () { if [ -e /usr/bin/curl ]; then curl -o- https://raw.github.com/grover66/kidtimer/master/kidtimer > /usr/local/bin/kidtimer if [ $? -eq 0 ]; then echo "/usr/local/bin/kidtimer has been updated from http://github.com/grover66/kidtimer.https://github.com/grover66/kidtimer. " else echo "Error. Download from http://github.com/grover66/kidtimerhttps://github.com/grover66/kidtimerfailed." fi else echo "Error. Curl is not installed. Please run;" echo "sudo apt-get install curl" fi }

go_help () { echo echo "Commands:" echo "--------------------------------------------------------------------------------" echo "addtime ... Increases allowed time for the day." echo "gettime ... Increases allowed time for the day." echo "logout ... Starts logout sequence for user." echo "hourly ... Enables/disables user access based on the schedule." echo "daily ... Resets time for the new day." echo "help ... This list." echo "--------------------------------------------------------------------------------" }

###################### Code #################### ################################################

go_check_install [ $TUI -eq 1 ] && go_tui

case "$COMMAND" in addtime) go_addtime ;; gettime) get_time ;; update) get_update ;; logout) go_logout $KID ;; initialize) go_initialize ;; hourly) go_hourly ;; daily) go_daily ;; check) go_check ;; -h) go_help ;; help) go_help ;; esac exit 0

my cron jobs: /etc/crontab: system-wide crontab Unlike any other crontab you don't have to run the `crontab' command to install the new version when you edit this file and files in /etc/cron.d. These files also have username fields, that none of the other crontabs do.

SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin m h dom mon dow user command

17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) #

— Reply to this email directly or view it on GitHubhttps://github.com/grover66/kidtimer/issues/1 .

barpi commented 10 years ago

I configured them to login without the need for a password. I also had to install "at".

I noticed that curl is not installed when I tried to install it:

arpi@arpi:~$ sudo apt get install curl [sudo] password for arpi: apt: invalid flag: get Usage: apt where apt options include: -classpath Specify where to find user class files and annotation processor factories -cp Specify where to find user class files and annotation processor factories -d Specify where to place processor and javac generated class files -s Specify where to place processor generated source files -source Provide source compatibility with specified release -version Version information -help Print a synopsis of standard options; use javac -help for more options -X Print a synopsis of nonstandard options -J Pass directly to the runtime system -A[key[=value]] Options to pass to annotation processors -nocompile Do not compile source files to class files -print Print out textual representation of specified types -factorypath Specify where to find annotation processor factories -factory Name of AnnotationProcessorFactory to use; bypasses default discovery process See javac -help for information on javac options.

warning: The apt tool and its associated API are planned to be removed in the next major JDK release. These features have been superseded by javac and the standardized annotation processing API, javax.annotation.processing and javax.lang.model. Users are recommended to migrate to the annotation processing features of javac; see the javac man page for more information. arpi@arpi:~$ man curl^C arpi@arpi:~$

grover66 commented 10 years ago

"apt-get" not apt get.

Mike :)

Sent from my iPhone

On Nov 23, 2013, at 7:18 PM, barpi notifications@github.com wrote:

I configured them to login without the need for a password. I also had to install "at".

I noticed that curl is not installed when I tried to install it:

arpi@arpi:~$ sudo apt get install curl [sudo] password for arpi: apt: invalid flag: get Usage: apt where apt options include: -classpath Specify where to find user class files and annotation processor factories -cp Specify where to find user class files and annotation processor factories -d Specify where to place processor and javac generated class files -s Specify where to place processor generated source files -source Provide source compatibility with specified release -version Version information -help Print a synopsis of standard options; use javac -help for more options -X Print a synopsis of nonstandard options -J Pass directly to the runtime system -A[key[=value]] Options to pass to annotation processors -nocompile Do not compile source files to class files -print Print out textual representation of specified types -factorypath Specify where to find annotation processor factories -factory Name of AnnotationProcessorFactory to use; bypasses default discovery process See javac -help for information on javac options.

warning: The apt tool and its associated API are planned to be removed in the next major JDK release. These features have been superseded by javac and the standardized annotation processing API, javax.annotation.processing and javax.lang.model. Users are recommended to migrate to the annotation processing features of javac; see the javac man page for more information. arpi@arpi:~$ man curl^C arpi@arpi:~$

— Reply to this email directly or view it on GitHub.

barpi commented 10 years ago

Ok I installed it, now it locked the kids out, but I could still log back on to their account. Then I tried to log in to mine and I found I can't log in to my account. I can reach ctr alt F2 console and there I can log in easily, but the graphical log in window doesn't recognizes my password. I forgot to mention that the script didn't ask for curl. I figured it out from reading the install script.

barpi

grover66 commented 10 years ago

Curl is only needed if you want to update the script from git. You can unlock an account by typing passwd -u username

Make sure your user is not in the kid.list file.

Mike

On Mon, Nov 25, 2013 at 1:37 PM, barpi notifications@github.com wrote:

Ok I installed it, now it locked the kids out, but I could still log back on to their account. Then I tried to log in to mine and I found I can't log in to my account. I can reach ctr alt F2 console and there I can log in easily, but the graphical log in window doesn't recognizes my password. I forgot to mention that the script didn't ask for curl. I figured it out from reading the install script.

barpi

— Reply to this email directly or view it on GitHubhttps://github.com/grover66/kidtimer/issues/1#issuecomment-29228706 .

grover66 commented 10 years ago

Hello,

I packaged my kidtimer script up today into a easy to install deb file. You can find it here; https://github.com/grover66/kidtimer

Just click on it and open it with Ubuntu Software Center, or download it and run the following command; sudo dpkg -i kidtimer_2.1.deb

Happy holidays,

Mike :)

On Sat, Nov 23, 2013 at 7:18 PM, barpi notifications@github.com wrote:

I configured them to login without the need for a password. I also had to install "at".

I noticed that curl is not installed when I tried to install it:

arpi@arpi:~$ sudo apt get install curl [sudo] password for arpi: apt: invalid flag: get Usage: apt where apt options include: -classpath Specify where to find user class files and annotation processor factories -cp Specify where to find user class files and annotation processor factories -d Specify where to place processor and javac generated class files -s Specify where to place processor generated source files -source Provide source compatibility with specified release -version Version information -help Print a synopsis of standard options; use javac -help for more options -X Print a synopsis of nonstandard options -J Pass directly to the runtime system -A[key[=value]] Options to pass to annotation processors -nocompile Do not compile source files to class files -print Print out textual representation of specified types -factorypath Specify where to find annotation processor factories -factory Name of AnnotationProcessorFactory to use; bypasses default discovery process See javac -help for information on javac options.

warning: The apt tool and its associated API are planned to be removed in the next major JDK release. These features have been superseded by javac and the standardized annotation processing API, javax.annotation.processing and javax.lang.model. Users are recommended to migrate to the annotation processing features of javac; see the javac man page for more information. arpi@arpi:~$ man curl^C arpi@arpi:~$

— Reply to this email directly or view it on GitHubhttps://github.com/grover66/kidtimer/issues/1#issuecomment-29145406 .