mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-06-06 14:46:27 +02:00
remove makefile
This commit is contained in:
parent
f955cf3db0
commit
38a8b023cb
276 changed files with 0 additions and 138 deletions
56
bin/gammu_get_unread_sms.py
Executable file
56
bin/gammu_get_unread_sms.py
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# vim: expandtab sw=4 ts=4 sts=4:
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
import gammu
|
||||
import sys
|
||||
import json
|
||||
|
||||
def main():
|
||||
state_machine = gammu.StateMachine()
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit(1)
|
||||
else :
|
||||
state_machine.ReadConfig(Filename=sys.argv[1])
|
||||
del sys.argv[1]
|
||||
|
||||
state_machine.Init()
|
||||
|
||||
status = state_machine.GetSMSStatus()
|
||||
|
||||
remain = status['SIMUsed'] + status['PhoneUsed'] + status['TemplatesUsed']
|
||||
|
||||
start = True
|
||||
|
||||
try:
|
||||
while remain > 0:
|
||||
if start:
|
||||
sms = state_machine.GetNextSMS(Start=True, Folder=0)
|
||||
start = False
|
||||
else:
|
||||
sms = state_machine.GetNextSMS(
|
||||
Location=sms[0]['Location'], Folder=0
|
||||
)
|
||||
remain = remain - len(sms)
|
||||
|
||||
for m in sms :
|
||||
if m['State'] != 'UnRead' :
|
||||
continue
|
||||
|
||||
print(json.dumps({
|
||||
'number': m['Number'],
|
||||
'at': str(m['DateTime']),
|
||||
'status': m['State'],
|
||||
'text': m['Text'],
|
||||
}))
|
||||
|
||||
except gammu.ERR_EMPTY:
|
||||
#do noting
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
27
bin/start.sh
Executable file
27
bin/start.sh
Executable 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 700 $LOG_FILE
|
||||
fi
|
||||
|
||||
#Run command to start daemons
|
||||
$COMMAND
|
||||
exit $?
|
48
bin/stop.sh
Executable file
48
bin/stop.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue