samtap / fang-hacks

Collection of modifications for the XiaoFang WiFi Camera
1.67k stars 340 forks source link

Prevent 00-stop-cloud script from killing cloud service when cloud setting is on #411

Closed stikhomirov closed 5 years ago

stikhomirov commented 5 years ago

Cloud service won't be killed on startup when disable-cloud option is off (0)

stikhomirov commented 5 years ago

@samtap , I faced an issue, when my camera got offline every time the scripts started. I figured out the problem is in stop cloud script, which kills xiaomi camera cloud app when disable cloud setting is set to 0. I'm not a developper, but I suggest it was a typo. Please, tell me, why did you close it?

samtap commented 5 years ago

The project is dead but github does't provide an option to disable pull-requests. Besides that, the change is wrong: if you set option disable-cloud off, it means cloud apps are enabled so should not be terminated at boot. That's the whole purpose of that option.

stikhomirov commented 5 years ago

@samtap It's always confusing to set the right value for disable_smth parameters, But in that case I think there was a bug, I'm pretty sure, plz check it again.

stop cloud script has a condition

source /etc/fang_hacks.cfg if [ "$DISABLE_CLOUD" -eq 0 ]; then echo "Stopping Cloud applications..."

which in my opinion means when DISABLE_CLOUD variable from config is set to 0 cloud service is being killed fewer strings later.

But your logic maybe was different:

Kill cloud app when DISABLE_CLOUD variable is set to true or "1" and vice versa DON'T kill cloud app when DISABLE_CLOUD option is set to "0"

Now in repo cloud service IS KILLED when the DISABLE_CLOUD option is set to 0 or off.

Please review the case and tell me where I'm wrong.

P.S as a workaround I disabled the stop cloud script from webinterface and the bug disappeared as it's no longer starts on boot as other scripts in the folder.

stikhomirov commented 5 years ago

if you set option disable-cloud off, it means cloud apps are enabled so should not be terminated at boot.

That's absolutely right, but the code does the opposite

stikhomirov commented 5 years ago

@samtap Please reply, because I suggest this bug as critical as cloud services now are killed dy default unexpectidely for users of your script. I can provide any help needed to fix it in your project if you don't have time for that. Fork doesn't look like a good idea as your project is the most popular one for hacking fang cameras