The Driving Force View on Github
‘I am so sorry. I slept at 2 am and couldn’t wake up on time.’
Today, most of us can relate ourselves to this, especially college going students and teenagers. I have this problem of sleeping very late (see I am awake and writing this post in the middle of the night and I am 200% sure that I’ll be late for my work tomorrow) I forget things, reach late for work/college and sometimes my friends have to wait till they get totally pissed off. And then I need to switch to a loop of apology to make the situation better.
The problem is alarms cannot wake me up, but getting a phone call on my mobile does. I don’t know why, but it works for me.
The Elucidation
A reminder utility bash script to make automatic repetitive calls to a mobile number at an interval.
Requirements
- Linux: because penguin.
- Skype Credit: as we need to make phone calls to your mobile (I had some credit from one of my previous hack).
How do we do it?
- Recieve command line parameters in shell script.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33echo Skype Reminder.
mobile=
hrs=
min=
sec=
delay=
N=
while getopts p:h:m:s:d:n: opt; do
case $opt in
p)
mobile=$OPTARG
;;
h)
hrs=$OPTARG
;;
m)
min=$OPTARG
;;
s)
sec=$OPTARG
;;
d)
delay=$OPTARG
;;
n)
N=$OPTARG
;;
esac
done
shift $((OPTIND - 1)) - Calculate the time and number of times the call should be made.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24let 'hrs = hrs + 0'
let 'min = min + 0'
let 'sec = sec + 0'
let 'delay = delay + 0'
let 'N = N + 0'
let 'tot = min + (hrs * 60)'
let 'tot = sec + (tot * 60)'
printf '\n'
echo "Mobile: "$mobile
echo "Hrs: "$hrs
echo "Min: "$min
echo "Sec: "$sec
echo "Total Sec: "$tot
if [ $N -eq '0' ]
then
let 'N = 1'
fi
printf '\n'
echo "Delay: "$delay
echo "Number of times: "$N - Create a loop to make phone calls consecutively using skype command.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17printf '\n'
sleep "$tot"
for (( c=1; c<=N; c++ ))
do
echo "Call "$c
skype --callto "$mobile"
if [ $N -eq $c ]
then
break;
fi
sleep "$delay"
done
printf '\n'
echo "Thank You for using our service."
printf '\n'
echo
"***************************************************************" - Save it as AngryAlbatross.sh in a directory, say ‘Documents’.
- Open terminal in the directory where this file is located and change permissions of the file.
1
2cd director_name
chmod +x AngryAlbatross.sh - Run the script with command line parameters. Eg. To make a call 5 times with delay of 30 seconds between consecutive calls, on a mobile number (+91XXXXXXXXXX), after 4 hrs 3 minutes and 10 seconds, use the following command.
1
2./AngryAlbatross.sh -p +phone -h hours -m minutes -s seconds -d delay_between_calls -n number_of_times
./AngryAlbatross.sh -p +91XXXXXXXXXX -h 4 -m 3 -s 10 -d 30 -n 5
Now wait for the call.