commit da39975867777ce9f970f7d919240533ff19fc15 Author: Stefano Marinelli Date: Wed Jun 5 17:31:02 2019 +0200 Added diff --git a/README.md b/README.md new file mode 100644 index 0000000..63ece6b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# bibliosangio + +Scripts for BiblioSangio \ No newline at end of file diff --git a/chillicount.sh b/chillicount.sh new file mode 100755 index 0000000..77a43dd --- /dev/null +++ b/chillicount.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +TOTSESSION=$1 +MIN=$((TOTSESSION/60)) + +while [ $MIN -gt 0 ]; do +clear > /dev/tty9 +echo "Sessione in corso..." > /dev/tty9 +echo "Minuti rimanenti: $MIN" > /dev/tty9 + +/dragas/generate_html.sh $MIN > /tmp/dragas/index.html + +MIN=$((MIN-1)); +sleep 59; +done diff --git a/chillicount1.sh b/chillicount1.sh new file mode 100755 index 0000000..509295d --- /dev/null +++ b/chillicount1.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/dragas/chillicount.sh $1 & diff --git a/chillikill.pl b/chillikill.pl new file mode 100755 index 0000000..386bdeb --- /dev/null +++ b/chillikill.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use IO::Socket; +my $sock = new IO::Socket::INET ( + LocalHost => '', + LocalPort => '7071', + Proto => 'tcp', + Listen => 1, + Reuse => 1, + ); +die "Could not create socket: $!\n" unless $sock; +my $new_sock = $sock->accept(); + while(<$new_sock>) { +# print $_; +# system("/usr/bin/killall VBoxSVC"); + system("/usr/bin/pkill -9 X"); + system("/usr/bin/pkill -9 perl"); + } + close($sock); diff --git a/chillilisten.pl b/chillilisten.pl new file mode 100755 index 0000000..20f8c83 --- /dev/null +++ b/chillilisten.pl @@ -0,0 +1,20 @@ +#!/usr/bin/perl + +use IO::Socket; +my $sock = new IO::Socket::INET ( + LocalHost => '', + LocalPort => '7070', + Proto => 'tcp', + Listen => 1, + Reuse => 1, + ); +die "Could not create socket: $!\n" unless $sock; +my $new_sock = $sock->accept(); + while(<$new_sock>) { +# print $_; + system("sudo /dragas/chillicount1.sh $_"); + system("/usr/bin/sudo /dragas/launchde.sh"); + system("/usr/bin/pkill -9 X"); + system("/usr/bin/pkill -9 perl"); + } + close($sock); diff --git a/daily_maint.sh b/daily_maint.sh new file mode 100755 index 0000000..2550681 --- /dev/null +++ b/daily_maint.sh @@ -0,0 +1,36 @@ +#!/bin/bash +PATH="/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/pkg/bin:/usr/pkg/sbin" +export PATH + +exec > /tmp/daily_maint.log +exec 2>&1 + +mkdir /tmp/dragas; cp /dragas/note.html /tmp/dragas/ + + +echo "Waiting for network to settle (3 minutes)..." +sleep 30s; +echo "2.30 minutes left..." +sleep 30s; +echo "2 minutes left..." +sleep 30s; +echo "1.30 minute left..." +sleep 30s; +echo "1 minute left..." +sleep 30s; +echo "30 seconds left..." +sleep 30s; +echo "Proceeding..." + +cd /usr/local/bibliosangio +git pull + +cp /dragas/note.html /tmp/dragas/ + +docker pull biblioregistry.dragashosting.com/timeleft +docker pull biblioregistry.dragashosting.com/bibliochromium +docker pull biblioregistry.dragashosting.com/bibliomate + +docker image prune -f + +echo "Done!" diff --git a/generate_html.sh b/generate_html.sh new file mode 100755 index 0000000..9d68bcd --- /dev/null +++ b/generate_html.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "" +echo " " +echo " Residuo: $1 minuti" +echo " " +echo " " +echo " " +echo "

Tempo Residuo di utilizzo: $1 minuti


" +echo "

" +echo '

Per iniziare a navigare, cliccare qui.



' +echo '

Per chiudere la sessione, cliccare su "Sistema" e "Termina Sessione"



' +echo 'Per indicazioni e note, cliccare qui.

' +echo "Si consiglia di minimizzare questa finestra. Il tempo residuo restera' bene in vista nella barra inferiore.
" +echo " " +echo " " + diff --git a/launchbrowser.sh b/launchbrowser.sh new file mode 100755 index 0000000..7287488 --- /dev/null +++ b/launchbrowser.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +perl /dragas/chillilisten.pl & +perl /dragas/chillikill.pl & +x11docker --desktop --hostipc --user=1500 biblioregistry.dragashosting.com/bibliochromium +pkill -9 X; +exit; diff --git a/launchde.sh b/launchde.sh new file mode 100755 index 0000000..1ce8250 --- /dev/null +++ b/launchde.sh @@ -0,0 +1,5 @@ +#!/bin/bash +/usr/bin/x11docker --vt=2 --desktop --sharedir=/media/usb0 --lang=it --hostipc --alsa --printer --user=4242 biblioregistry.dragashosting.com/bibliomate +pkill -9 chillicount; +pkill -9 X; +exit; diff --git a/note.html b/note.html new file mode 100644 index 0000000..be953c9 --- /dev/null +++ b/note.html @@ -0,0 +1 @@ +Le chiavette vanno inserite PRIMA di utilizzare il computer, altrimenti non funzioneranno