Fix rights, add confs apache, add prototype of systemd confs, add scripts to start and stop raspisms

This commit is contained in:
osaajani 2020-01-09 11:28:25 +01:00
parent aa3189bfaa
commit 89d786a730
45 changed files with 95 additions and 2 deletions

0
.gitignore vendored Normal file → Executable file
View File

View File

@ -1,2 +1,3 @@
RewriteEngine on
RewriteRule !\.(js|ico|ICO|gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|css|woff|woff2|ttf|wav|ogg|mp3)$ index.php
RewriteBase "/raspisms/"
RewriteRule "!\.(js|ico|ICO|gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|css|woff|woff2|ttf|wav|ogg|mp3)$" index.php

0
LICENSE Normal file → Executable file
View File

0
adapters/AdapterInterface.php Normal file → Executable file
View File

0
adapters/OvhSmsAdapter.php Normal file → Executable file
View File

0
adapters/TestAdapter.php Normal file → Executable file
View File

0
assets/css/intlTelInput.min.css vendored Normal file → Executable file
View File

0
assets/css/plugins/morris.css Normal file → Executable file
View File

0
assets/img/favicon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

0
assets/img/flags.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

0
assets/img/flags@2x.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB

0
assets/js/intlTelInput/intlTelInput.min.js vendored Normal file → Executable file
View File

0
assets/js/intlTelInput/utils.js Normal file → Executable file
View File

0
assets/js/jquery.shiftcheckbox.js Normal file → Executable file
View File

0
assets/js/plugins/morris/morris.min.js vendored Normal file → Executable file
View File

0
assets/js/plugins/morris/raphael-min.js vendored Normal file → Executable file
View File

27
bin/start.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
#
# Script to start RaspiSMS daemons
#
PID_DIR="/var/run/raspisms/"
LOG_FILE="/var/log/raspisms.log"
SCRIPT=$(readlink -f "$0")
RASPISMS_DIR=$(readlink -f "${SCRIPT%/*}/../")
CONSOLE_PATH="$RASPISMS_DIR/console.php"
COMMAND="php $CONSOLE_PATH controllers/internals/Console.php launcher"
#Create PID DIR IF NOT EXISTS
if [ ! -d $PID_DIR ]
then
mkdir $PID_DIR
fi
#Create log file if not exists
if [ ! -f $LOG_FILE ]
then
touch $LOG_FILE
chmod 777 $LOG_FILE
fi
#Run command to start daemons
$COMMAND
exit $?

48
bin/stop.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# Script to stop RaspiSMS daemons
#
PID_DIR="/var/run/raspisms"
DAEMON_LAUNCHER_PID_FILE="/var/run/raspisms/RaspiSMS Daemon Launcher.pid"
PID_FILES=$PID_DIR/*.pid
kill_process()
{
local PID=$1
kill "$PID"
return $?
}
#Kill daemon launcher if available
if [ -f "$DAEMON_LAUNCHER_PID_FILE" ]
then
printf "Stop RaspiSMS daemon Launcher..."
PID=$(cat "$DAEMON_LAUNCHER_PID_FILE")
$(kill_process "$PID")
RETURN=$?
if [ $RETURN -eq 0 ]
then
printf "success.\n"
else
printf "failed.\n"
exit 1
fi
fi
sleep 1
printf "Stop RaspiSMS remaining daemons..."
for f in $PID_FILES
do
[ -f "$f" ] || continue #Bypass no real file return on empty dir
printf "."
PID=$(cat "$f")
kill_process "$PID"
done
printf "Done.\n"
exit 0

13
bin/systemd/raspisms.service Executable file
View File

@ -0,0 +1,13 @@
[Unit]
Description=RaspiSMS Daemons
Documentation=https://raspisms.raspberry-pi.fr
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/raspisms/RaspiSMS Daemon Launcher.pid
ExecStart=/opt/raspisms/bin/start.sh
ExecStop=/opt/raspisms/bin/start.sh
WorkingDirectory=/opt/raspisms
Restart=on-failure

View File

@ -0,0 +1,4 @@
<LocationMatch "^/raspisms">
Options +FollowSymLinks
AllowOverride All
</LocationMatch>

0
controllers/internals/ExpressionProvider.php Normal file → Executable file
View File

0
daemons/AbstractDaemon.php Normal file → Executable file
View File

0
daemons/Launcher.php Normal file → Executable file
View File

0
daemons/Phone.php Normal file → Executable file
View File

0
daemons/Sender.php Normal file → Executable file
View File

0
daemons/Webhook.php Normal file → Executable file
View File

0
datas/.tokeep Normal file → Executable file
View File

0
datas/test_read_sms.json Normal file → Executable file
View File

0
db/migrations/20191206123238_first_migration.php Normal file → Executable file
View File

View File

View File

0
db/migrations/20200107232628_add_api_key_user.php Normal file → Executable file
View File

View File

View File

@ -4,7 +4,7 @@
/*
* Define Descartes env
*/
$http_dir_path = ''; //Path we need to put after servername in url to access app
$http_dir_path = '/raspisms'; //Path we need to put after servername in url to access app
$http_protocol = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://';
$http_server_name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';
$http_server_port = isset($_SERVER['SERVER_PORT']) ? ($_SERVER['SERVER_PORT'] == 80) ? '' : ':' . $_SERVER['SERVER_PORT'] : '';

0
descartes/exceptions/DescartesException404.php Normal file → Executable file
View File

View File

View File

View File

0
descartes/exceptions/DescartesExceptionSqlError.php Normal file → Executable file
View File

View File

0
descartes/load-environment.php Normal file → Executable file
View File

0
scripts/.tokeep Normal file → Executable file
View File

0
tests/php-cs-fixer/.php_cs.cache Normal file → Executable file
View File

0
tests/php-cs-fixer/php_cs.config Normal file → Executable file
View File

0
tests/phpstan/config.neon Normal file → Executable file
View File