Skip to content

Commit

Permalink
MAJOR: add new daemon ratesmsd to calculate user's credit periodicall…
Browse files Browse the repository at this point in the history
…y and update user's credit field
  • Loading branch information
antonraharja committed May 14, 2016
1 parent ad2d870 commit 679cc7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions daemon/linux/bin/playsmsd.php
Expand Up @@ -47,6 +47,7 @@ function playsmsd_pid_get($process) {
*/
function playsmsd_pids() {
$pids['schedule'] = playsmsd_pid_get('schedule');
$pids['ratesmsd'] = playsmsd_pid_get('ratesmsd');
$pids['dlrssmsd'] = playsmsd_pid_get('dlrssmsd');
$pids['recvsmsd'] = playsmsd_pid_get('recvsmsd');
$pids['sendsmsd'] = playsmsd_pid_get('sendsmsd');
Expand All @@ -59,6 +60,7 @@ function playsmsd_pids() {
function playsmsd_pids_show() {
$pids = playsmsd_pids();
echo "schedule at pid " . $pids['schedule'] . "\n";
echo "ratesmsd at pid " . $pids['ratesmsd'] . "\n";
echo "dlrssmsd at pid " . $pids['dlrssmsd'] . "\n";
echo "recvsmsd at pid " . $pids['recvsmsd'] . "\n";
echo "sendsmsd at pid " . $pids['sendsmsd'] . "\n";
Expand Down Expand Up @@ -100,6 +102,7 @@ function playsmsd_start() {

// run playsmsd services
shell_exec("nohup $PLAYSMSD_COMMAND schedule >/dev/null 2>&1 &");
shell_exec("nohup $PLAYSMSD_COMMAND ratesmsd >/dev/null 2>&1 &");
shell_exec("nohup $PLAYSMSD_COMMAND dlrssmsd >/dev/null 2>&1 &");
shell_exec("nohup $PLAYSMSD_COMMAND recvsmsd >/dev/null 2>&1 &");
shell_exec("nohup $PLAYSMSD_COMMAND sendsmsd >/dev/null 2>&1 &");
Expand Down Expand Up @@ -445,6 +448,10 @@ function playsmsd_log($debug_file = '') {
playsmsd();
break;

case 'ratesmsd':
rate_update();
break;

case 'dlrssmsd':
dlrd();
getsmsstatus();
Expand Down
10 changes: 10 additions & 0 deletions web/lib/fn_rate.php
Expand Up @@ -22,6 +22,16 @@ function rate_getbyprefix($sms_to) {
return core_call_hook();
}

/**
* Calculate user's credit balance and save it in user's credit field
*
* @param string $username
* Username
*/
function rate_update($username) {
return core_call_hook();
}

function rate_getusercredit($username) {
return core_call_hook();
}
Expand Down

0 comments on commit 679cc7c

Please sign in to comment.