Page 1 of 1

Bash script error returned: 32256 synology

Posted: Sunday 31 January 2016 17:16
by TheSnitz
Hi,

i made this script (with Dutch comments :lol: :)

Code: Select all

#!/bin/bash

#-------------------------------------------------------------------------------------------------------
#Met dit script wordt het volume bij uitschakelen steeds verminderd met 0.5 tot -80 wat geheel uit is.
#-------------------------------------------------------------------------------------------------------

#Settings
DENONIP="10.0.0.116"        # Denon IP Address

VolumeSubstraction="-0.5"	#Volume vermindering met -0.5		
VolumeUit="-80.0"			#Volume Uit stand	


#Start Script
   
	# Haal de xml file uit de Denon versterker en stop deze in het bestand Denon.txt
       curl http://$DENONIP/goform/formMainZone_MainZoneXml.xml > Denon.txt
	   sleep 1
	
	# Haal uit het Denon.txt bestand het Volume 
     	Volume=$(sed -n -e 's/.*\<MasterVolume><value>\(.*\)<\/value>.*/\1/p' Denon.txt)
			echo Het start volume is:$Volume
		
	# Fade het geluid uit	
		for VolumeFade in $(seq $Volume $VolumeSubstraction $VolumeUit) 
			do 
				echo $VolumeFade	#Print het geFade volume 
				#Update de Dennon versterker met het geFade geluid
				curl http://$DENONIP/MainZone/index.put.asp?cmd0=PutMasterVolumeSet%2F$VolumeFade
					sleep 0.1
						VolumeFade=$VolumeFade
		done	
		
# Vergelijk de Fade waarde met de Uit waarde. 	
	if [ "$VolumeFade" = "$VolumeUit" ] ; then
		echo "Denon Geluid is Uit"
	
	# Zet audio weergave op dts suround
	curl http://10.0.0.116/MainZone/index.put.asp?cmd0=PutSurroundMode/DTS%20SURROUND
		echo "Muziek weergave op DTS Surround"
		sleep 1

	# Zet Input op SAT/CBL 
	curl http://10.0.0.116/MainZone/index.put.asp?cmd0=PutZone_InputFunction/SAT/CBL
		echo "Input op SAT/CBL zetten"
		sleep 1

	#Zet de Denon versterker uit
	curl http://10.0.0.116/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FOFF
		echo "Zet de versterker uit"
 fi
	
#Einde script
	
If i run this script with WINSCP and i type in the command box: sh Denon_Uitzetten.sh
it works and my receiver volume goes to zero and then it goes off.

But if i run it with Domoticz i get this error:
Error: Error executing script command (//volume1/@appstore/domoticz/var/scripts/Denon_Uitzetten.sh). returned: 32256

I try'd it with a lua script to fire it with a sh command and that wil not work.

The permission of the files is:DOMOTICZ

Hope someone can help me

Re: Bash script error returned: 32256 synology

Posted: Wednesday 16 March 2016 18:50
by mavl
I have the same error 32256 running a LUA-script from Domoticz on a Synology NAS. Where you able to solve it?

Re: Bash script error returned: 32256 synology

Posted: Wednesday 16 March 2016 19:24
by TheSnitz
[quote="mavl"]I have the same error 32256 running a LUA-script from Domoticz on a Synology NAS. Where you able to solve it?

Hi mavl,

This works for me:
os.execute ("sh //volume1/@appstore/domoticz/var/scripts/Denon_Uitzetten.sh &")

But i also have problems with permissions. It look like my domoticz has no admin rights but i don't know how to fix this. I boodstrapped my nas so that i can use more functions in bash scripts. In shh it works great but if i fire it from lua some functions are not fired because the functions are installed in another directory(automaticly). My tempory solution is to copy the extra functions for eg the "BC" function to that directory (sorry i dont know the correct location @the moment). The folder names are the same but on a different location on the synology nas.

Hope that above fix your problem.

Re: Bash script error returned: 32256 synology

Posted: Wednesday 16 March 2016 19:25
by stlaha2007
Besides the error you do an echo of its dtarting volume. You left out sibgle or doublequotes...

I saw you also checked rights... it looks like whats mentioned is a use or group... not sure which.

When you run the script manually within WinSCP, how are you connected? Which user.

Perhaps try that user with an putty session and run it on the commandline.
And within WinSCP you can rightclick for properties. Use that to verify user AND group. And which rights ideal would be rwxr-xr-x (755 as in read,write,execute)
And is Domoticz also running under that user/group.

Within putty at the commandline you can also run: ps -ef | grep domoticz and see under which user/group domoticz is running.

Grtz,
Stephan

Re: Bash script error returned: 32256 synology

Posted: Wednesday 16 March 2016 19:50
by TheSnitz
stlaha2007 wrote:Besides the error you do an echo of its dtarting volume. You left out sibgle or doublequotes...

I saw you also checked rights... it looks like whats mentioned is a use or group... not sure which.

When you run the script manually within WinSCP, how are you connected? Which user.

Perhaps try that user with an putty session and run it on the commandline.
And within WinSCP you can rightclick for properties. Use that to verify user AND group. And which rights ideal would be rwxr-xr-x (755 as in read,write,execute)
And is Domoticz also running under that user/group.

Within putty at the commandline you can also run: ps -ef | grep domoticz and see under which user/group domoticz is running.

Grtz,
Stephan

Hi Stephan,

In winscp i connect with user root also in putty the script runs fine. But fired from domoticz lua it gives errors.

You are right domoticz is no member of any group. I installed the package from jumbotroll and launched domoticz and it works. After troubles with scripting i looked further So i make a group called "Groep_Domoticz" and want to attach the domoticz package. I can choose al my installed synology package but not domoticz. I think there is the problem but i don't know how2 fix that.

The command line code that you give me, give a error that "e" is not a valid option. So ps -ef | grep domoticz does not work on my synology with user root.

If i run this: more /etc/group in the command line i can see that :

-nobody:x:99:domoticz
-Groep_Domoticz:x:65537:Domotica

So that tell's me i think that the package domoticz member is from nobody but nobody does not exist. Question how can i fix this?

grtz

Mark

Re: Bash script error returned: 32256 synology

Posted: Wednesday 16 March 2016 21:43
by Martin
Mark,

I am not an expert, but run into the same problem. Looking at this again. I noticed.
this on synology forum https://forum.synology.com/enu/viewtopic.php?t=83313
Looking in /var/packages/domoticz/scripts/start-stop-status
I see at line 11 # USER="domoticz"
Maybe stopping the domoticz package, remove the hashtag and replace domoticz by root, start package again. Might help.

Good luck,

Martin

Re: Bash script error returned: 32256 synology

Posted: Wednesday 16 March 2016 22:08
by stlaha2007
Have read the synology-forum post. Dont own a Synology, but Qnap. To my knowledge it IS a permission problem.

Dont run custom packages under root. Solve the permissions. According to the post packages run under its own user or custom user. The problem with that is that the appear not to be assign to a group like users.

Basicly those NASses run on a stripped down version of linux (mostly debian-like). So main tools like adduser and groupadd are available. Google for examples.
Perhaps the user/group webbased management can solve your problem just with assigning domoticz to group users. Most of the time the ARE assigned to users by default when you create a user yourself that way.

So i would say create a DomoUser, and by cli check if group users has read/exec to the domoticz directory. Or simply assign 775 to the directory including the files and directories under it. winSCP has an option for that as well.

Grtz,
Stephan

Re: Bash script error returned: 32256 synology

Posted: Friday 08 December 2017 15:08
by FafaDomo
Hi,

Solution is HERE

(Only for Synology, not RPI)