From eab0f043fa4cc5272eafc34568f6ef27eaf2b78f Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 18 Feb 2014 16:11:18 +0000 Subject: [PATCH] structured scripts --- bin/_boot/audio_boot_notification | 6 ++++++ bin/_boot/notify_boot.sh | 14 ++++++++++++++ bin/notify_boot.sh | 15 +-------------- bin/on_boot | 13 +++++++++++++ bin/say_in_english | 3 +++ bin/say_in_french | 4 ++++ 6 files changed, 41 insertions(+), 14 deletions(-) create mode 100755 bin/_boot/audio_boot_notification create mode 100755 bin/_boot/notify_boot.sh mode change 100755 => 120000 bin/notify_boot.sh create mode 100755 bin/on_boot create mode 100755 bin/say_in_english create mode 100755 bin/say_in_french diff --git a/bin/_boot/audio_boot_notification b/bin/_boot/audio_boot_notification new file mode 100755 index 0000000..3604f59 --- /dev/null +++ b/bin/_boot/audio_boot_notification @@ -0,0 +1,6 @@ +#!/bin/bash + +/home/pi/bin/say_in_english "Hello, raspberry pi `hostname` is booting" || true +/home/pi/bin/say_in_english "IP is `hostname -I`" || true + +exit 0 diff --git a/bin/_boot/notify_boot.sh b/bin/_boot/notify_boot.sh new file mode 100755 index 0000000..440f4ab --- /dev/null +++ b/bin/_boot/notify_boot.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +_IP=$(hostname -I) || true +_NAME=$(hostname) || true +_TMP=/tmp/Text.notify_boot.tmp + +echo From: djocebot@gmail.com > $_TMP +echo To: jocelyn.fiat@gmail.com >> $_TMP +echo Subject: $_NAME ip=$_IP >> $_TMP +echo rpi ip=$_IP >> $_TMP +echo . >> $_TMP + +curl -s -n --ssl-reqd --mail-from djocebot@gmail.com --mail-rcpt jocelyn.fiat@gmail.com --url smtps://smtp.gmail.com:465 -T $_TMP -u "djocebot@gmail.com:DjocBOT31" + diff --git a/bin/notify_boot.sh b/bin/notify_boot.sh deleted file mode 100755 index 440f4ab..0000000 --- a/bin/notify_boot.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -_IP=$(hostname -I) || true -_NAME=$(hostname) || true -_TMP=/tmp/Text.notify_boot.tmp - -echo From: djocebot@gmail.com > $_TMP -echo To: jocelyn.fiat@gmail.com >> $_TMP -echo Subject: $_NAME ip=$_IP >> $_TMP -echo rpi ip=$_IP >> $_TMP -echo . >> $_TMP - -curl -s -n --ssl-reqd --mail-from djocebot@gmail.com --mail-rcpt jocelyn.fiat@gmail.com --url smtps://smtp.gmail.com:465 -T $_TMP -u "djocebot@gmail.com:DjocBOT31" - diff --git a/bin/notify_boot.sh b/bin/notify_boot.sh new file mode 120000 index 0000000..c0eab49 --- /dev/null +++ b/bin/notify_boot.sh @@ -0,0 +1 @@ +_boot/notify_boot.sh \ No newline at end of file diff --git a/bin/on_boot b/bin/on_boot new file mode 100755 index 0000000..8e6a984 --- /dev/null +++ b/bin/on_boot @@ -0,0 +1,13 @@ +#!/bin/bash + +/home/pi/bin/_boot/notify_boot.sh || true + +if [ "$1" != "" ]; then + echo Boot tests +else + /home/pi/bin/_boot/nas.sh || true +fi + +/home/pi/bin/_boot/audio_boot_notication || true + +exit 0 diff --git a/bin/say_in_english b/bin/say_in_english new file mode 100755 index 0000000..c667dc8 --- /dev/null +++ b/bin/say_in_english @@ -0,0 +1,3 @@ +#!/bin/bash +say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*"; } +say $* diff --git a/bin/say_in_french b/bin/say_in_french new file mode 100755 index 0000000..580243c --- /dev/null +++ b/bin/say_in_french @@ -0,0 +1,4 @@ +#!/bin/bash +say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=fr&q=$*"; } +#say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*"; } +say $*