Hi Janui,
I have rechecked the code and believe I have everything as it should be but it still refuses to actually start the service. Note, I am checking the status of the service using:
systemctl statusHere are my modifications:
int app/templates/settings.php
- Code: Select all
<legend>Features management</legend>
<p>Enable/disable optional modules that best suit your needs. Disabling unused features will free system resources and might improve the overall performance</p>
<div class="form-group">
<label for="snapclient" class="control-label col-sm-2">Snapclient</label>
<div class="col-sm-10">
<label class="switch-light well" onclick="">
<input id="snapclient" name="features[snapclient]" type="checkbox" value="1"<?php if($this->snapclient == 1): ?> checked="checked" <?php endif ?>>
<span><span>OFF</span><span>ON</span></span><a class="btn btn-primary"></a>
</label>
<span class="help-block">Toggle the capability of receiving snapcast streaming of audio</span>
</div>
</div>
in app/settings_ctl.php
- Code: Select all
if (isset($_POST['features'])) {
if ($_POST['features']['snapclient'] == 1) {
$redis->hGet('snapclient') == 1 || $jobID[] = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'snapclientstart'));
} else {
$redis->hGet('snapclient') == 0 || $jobID[] = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'snapclientstop'));
}
if ($_POST['features']['airplay']['enable'] == 1) {
and
- Code: Select all
$template->orionprofile = $redis->get('orionprofile');
$template->snapclient = $redis->get('snapclient');
$template->airplay = $redis->hGetAll('airplay');
in ./command/rune_SY_wrk
- Code: Select all
// start snapclient
if ($redis->get('snapclient')) {
sysCmdAsync('systemctl start snapclient');
}
and
- Code: Select all
case 'snapclientstart':
runelog('wrk_SY: ', $job->wrkcmd);
$redis->sAdd('w_lock', $jobID);
$redis->hSet('snapclient', 1);
sysCmd('systemctl start snapclient');
$redis->sRem('w_lock', $jobID);
break;
case 'snapclientstop':
runelog('wrk_SY: ', $job->wrkcmd);
$redis->sAdd('w_lock', $jobID);
$redis->hSet('snapclient', 0);
sysCmd('systemctl stop snapclient');
$redis->sRem('w_lock', $jobID);
break;
case 'xorgserverstart':
runelog('wrk_SY: ', $job->wrkcmd);
Have also manually added an entry to redis using
redis-cli set snapclient 0Testing this shows:
- Code: Select all
root@pergola-pi(rw):/var/www# redis-cli get snapclient
"0"
root@pergola-pi(rw):/var/www#
When set for 0, changing the settings page to enabled and then applying provides the following logs:
from tail -f runeui.log
PHP message: ### wrk_control data: ### {"wrkcmd":"snapclientstart","action":null,"args":null}
PHP message: [wrk_control] ### [wrk] wrk_control($redis,newjob,$data) jobID=12b326da083f13ae9c7f91e562782771 ### $data type = array
PHP message: [wrk_control] ### [wrk] wrk_control($redis,newjob,$data) jobID=12b326da083f13ae9c7f91e562782771 ### ['wrkcmd'] => snapclientstartfrom tail -f rune_SY_wrk.log
[02-Nov-2018 05:22:05 UTC] ### sysCmd($str) ### systemctl start upmpdcli
[02-Nov-2018 05:22:05 UTC] ### sysCmd() output: ### $data type = array
[02-Nov-2018 05:22:05 UTC] ### notify (async) JSON string: ### {"title":"UPnP \/ DLNA","text":"UPnP \/ DLNA feature enabled"}
[02-Nov-2018 05:22:06 UTC] [sysCmdAsync] ### sysCmdAsync($cmdstr) decoded ### /var/www/command/ui_notify.php '{"title":"UPnP \/ DLNA","text":"UPnP \/ DLNA feature enabled" }
[02-Nov-2018 05:22:06 UTC] [sysCmdAsync] ### sysCmdAsync($cmdstr) encoded ### /var/www/command/cmd_async L3Zhci93d3cvY29tbWFuZC91aV9ub3RpZnkucGhwICd7InRpdGxlIjoiVVBuUCBcLy BETE5BIiwidGV4dCI6IlVQblAgXC8gRExOQSBmZWF0dXJlIGVuYWJsZWQifQ==
[02-Nov-2018 05:22:06 UTC] [sysCmdAsync] ### sysCmdAsync() output: ### $data type = array
[02-Nov-2018 05:22:06 UTC] ### (loop) delete job_queue ### 1f769e3ffedae0e08f0e15d0cf79e60c
[02-Nov-2018 05:22:06 UTC] ### (loop) start job ### 12b326da083f13ae9c7f91e562782771
[02-Nov-2018 05:22:06 UTC] ### wrk_SY: ### snapclientstart
[02-Nov-2018 05:22:06 UTC] ### sysCmd($str) ### systemctl start snapclient
[02-Nov-2018 05:22:06 UTC] ### sysCmd() output: ### $data type = array
[02-Nov-2018 05:22:06 UTC] ### (loop) delete job_queue ### 12b326da083f13ae9c7f91e562782771
[02-Nov-2018 05:22:08 UTC] ### sysCmd($str) ### systemctl is-active ashuffle
[02-Nov-2018 05:22:08 UTC] ### sysCmd() output: ### $data type = array
[02-Nov-2018 05:22:08 UTC] ### sysCmd() output: ### ['0'] => inactive
[02-Nov-2018 05:22:17 UTC] ### sysCmd($str) ### systemctl is-active ashuffle
[02-Nov-2018 05:22:17 UTC] ### sysCmd() output: ### $data type = array
[02-Nov-2018 05:22:17 UTC] ### sysCmd() output: ### ['0'] => inactive
[02-Nov-2018 05:22:25 UTC] ### sysCmd($str) ### systemctl is-active ashuffle
[02-Nov-2018 05:22:25 UTC] ### sysCmd() output: ### $data type = array
[02-Nov-2018 05:22:25 UTC] ### sysCmd() output: ### ['0'] => inactive
If I manually enable redis for snapclient using
redis-cli set snapclient 1The settings page correctly loads with the button showing enabled.
If I try to disable it and apply, there is no output for snapclient in either log. This indicates to me that
- Code: Select all
$redis->hGet('snapclient') == 0
in settings_ctl is true, thus
- Code: Select all
wrk_control
is not executed.
From the terminal, redis-cli shows it is actually enabled:
root@pergola-pi(rw):/var/www# redis-cli get snapclient
"1"
root@pergola-pi(rw):/var/www#
Really not sure what I'm missing.
thanks.