BMX Bicycle freestyle
BMX Bicycle freestyle

Sunday, October 18, 2009

Alarm clock/calendar in bash

alarm clock/calendar without cron
overview: terminal script check if time is the same when alarm goes off and notify user wth notification (could use some music or just sudo apt-get install beep for some sound)

daa=$(date +%H%M)
if [ "$daa" -eq "1133" ] || ["$daa" -eq "1134" ]
then
echo rabbits gone to bed
/usr/bin/notify-send -u normal -t 20000 \
'rabbits gone to bed'
fi

#here alarm is so tinny (single line) that you wont see it when concentrated on something
#this first uses | to make alarm interval specified more accurately

daa=$(date +%H%M)
if [ "$daa" -eq "2823" ]
then
echo end of month coming. today 28. finish your bandwith month limitations
/usr/bin/notify-send -u normal -t 4000000 \
'end of month near' 'finish your bandwith month limitations'
fi

daa=$(date +%d)
if [ "$daa" -eq "01" ]
then
echo first of month
/usr/bin/notify-send -u normal -t 2000 \
'first of month' 'first of month'
sleep 10000
fi

you may also alarm yourself:
cheaper electricity time
time to go out
time to open windows (to let air in, best time)

DVD movie released today!
some stuff u care about
best time check news some mail or sth



date accepts
# %H hour (00..23)
# %I hour (01..12)
# %j day of year (001..366)
# %k hour ( 0..23)
# %l hour ( 1..12)
# %m month (01..12)
# %M minute (00..59)



you should run script continuously inside

while (true)
do
#script goes here
sleep 1000
done


and should be run with & at end to run in bash background
sorry blinking screen is not ready yet for alarm, please post it in comments if you dare

0 comments:

Post a Comment