GPIO not staying on

Hi, I got all my GPIO working to turn relays on and off, the only problem though is that the GPIO only stays on for 15 s then goes low again, and the state also changes in the GUI. How can I avoid this in a switch item?

It seems that there is soemthing wrong with permision of the sys/class/gpio. Do I need to do chmod -R755 on this folder?

I made this little shell script to test all my relays, however it doesnt work:

echo Initializing

echo 2 > unexport	
echo 3 > unexport	
echo 4 > unexport	
echo 17 > unexport	
echo 27 > unexport	
echo 22 > unexport	
echo 10 > unexport	
echo 9 > unexport	
echo 11 > unexport	
echo 5 > unexport	
echo 6 > unexport	
echo 13 > unexport	
echo 19 > unexport	
echo 26 > unexport	
echo 14 > unexport	
echo 15 > unexport	
echo 18 > unexport	
echo 23 > unexport	
echo 24 > unexport	
echo 25 > unexport	
echo 8 > unexport	
echo 7 > unexport	
echo 12 > unexport	
echo 16 > unexport	
echo 20 > unexport	
echo 21 > unexport


echo 2 > export
echo 3 > export
echo 4 > export
echo 17 > export
echo 27 > export
echo 22 > export
echo 10 > export
echo 9 > export
echo 11 > export
echo 5 > export
echo 6 > export
echo 13 > export
echo 19 > export
echo 26 > export
echo 14 > export
echo 15 > export
echo 18 > export
echo 23 > export
echo 24 > export
echo 25 > export
echo 8 > export
echo 7 > export
echo 12 > export
echo 16 > export
echo 20 > export
echo 21 > export


echo out > gpio2/direction
echo out > gpio3/direction
echo out > gpio4/direction
echo out > gpio17/direction
echo out > gpio27/direction
echo out > gpio22/direction
echo out > gpio10/direction
echo out > gpio9/direction
echo out > gpio11/direction
echo out > gpio5/direction
echo out > gpio6/direction
echo out > gpio13/direction
echo out > gpio19/direction
echo out > gpio26/direction
echo out > gpio14/direction
echo out > gpio15/direction
echo out > gpio18/direction
echo out > gpio23/direction
echo out > gpio24/direction
echo out > gpio25/direction
echo out > gpio8/direction
echo out > gpio7/direction
echo out > gpio12/direction
echo out > gpio16/direction
echo out > gpio20/direction
echo out > gpio21/direction

echo  Setting all gpio high

echo 1> gpio2/value
echo 1> gpio3/value
echo 1> gpio4/value
echo 1> gpio17/value
echo 1> gpio27/value
echo 1> gpio22/value
echo 1> gpio10/value
echo 1> gpio9/value
echo 1> gpio11/value
echo 1> gpio5/value
echo 1> gpio6/value
echo 1> gpio13/value
echo 1> gpio19/value
echo 1> gpio26/value
echo 1> gpio14/value
echo 1> gpio15/value
echo 1> gpio18/value
echo 1> gpio23/value
echo 1> gpio24/value
echo 1> gpio25/value
echo 1> gpio8/value
echo 1> gpio7/value
echo 1> gpio12/value
echo 1> gpio16/value
echo 1> gpio20/value
echo 1> gpio21/value


sleep 20

echo Unexporting all

echo 2 > unexport	
echo 3 > unexport	
echo 4 > unexport	
echo 17 > unexport	
echo 27 > unexport	
echo 22 > unexport	
echo 10 > unexport	
echo 9 > unexport	
echo 11 > unexport	
echo 5 > unexport	
echo 6 > unexport	
echo 13 > unexport	
echo 19 > unexport	
echo 26 > unexport	
echo 14 > unexport	
echo 15 > unexport	
echo 18 > unexport	
echo 23 > unexport	
echo 24 > unexport	
echo 25 > unexport	
echo 8 > unexport	
echo 7 > unexport	
echo 12 > unexport	
echo 16 > unexport	
echo 20 > unexport	
echo 21 > unexport	

cd /home/pi/openhab

I also cleared my rules file and stripped my item file:

Group All

Group GF_Kitchen 
Group GF_Living 
Group FF_Bath 	
Group FF_Bed 		
Group FF_MasterBedroom			
Group GF_Toilet 	
Group GF_Corridor 	




/* active groups */
Group:Switch:OR(ON, OFF) 		Lights 		"All Lights [(%d)]" 								(All)
Group:Switch:OR(ON, OFF) 		Heating 	"No. of Active Heatings [(%d)]" 	<heating> 		(All)


/* Lights */
/*
Switch Light_GF_Living_Table 		"Module 1" 		(GF_Living, Lights) { gpio="pin:12" }  
Switch Light_GF_Center 				"Module 2" 		(GF_Living, Lights) { gpio="pin:19" }   
Switch Light_GF_Tv 					"Module 3" 		(GF_Living, Lights) { gpio="pin:16" }
Switch Light_GF_Bar 				"Module 4" 		(GF_Living, Lights) { gpio="pin:26" }

Switch Light_GF_Elefant 			"Elefant" 		(GF_Living, Lights) { gpio="pin:6" }
Switch Light_GF_Glass 				"Glass" 		(GF_Living, Lights) { gpio="pin:13" }
Switch Light_GF_WallWasher 			"Wall washer" 		(GF_Living, Lights) { gpio="pin:20" }


Switch Light_FF_Bath_Ceiling 		"Ceiling" 		(FF_Bath, Lights) { gpio="pin:9" }


Switch Light_SF_Corridor_Ceiling 	"Ceiling"  (GF_Corridor, Lights)	{ gpio="pin:10" }
*/
Switch Light_SF_Corridor_Door 	"Door Opener" <heating> (GF_Corridor, Lights)	{ gpio="pin:22" }
/* Heating */
/*
Switch Heating_GF_Corridor 	"Hallway Heating" 	<heating>	(GF_Corridor, Heating) { gpio="pin:17" }

Switch Heating_GF_Living 	"Livingroom" 	<heating>	(GF_Living, Heating){ gpio="pin:27" }
Switch Heating_GF_Kitchen 	"Kitchen" 		<heating>	(GF_Kitchen, Heating){ gpio="pin:11" }

Switch Heating_FF_Bath 		"Bath" 			<heating>	(FF_Bath, Heating){ gpio="pin:5" }
Switch Heating_FF_Office 	"Master bedroom" 		<heating>	(FF_MasterBedroom	, Heating){ gpio="pin:21" }

Switch Heating_FF_Bed 		"Bedroom" 		<heating>	(FF_Bed, Heating){ gpio="pin:4" }

/*

This is the rc.local file I use

	#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

chgrp -R dialout /sys/class/gpio
chmod -R g+rw /sys/class/gpio

 sudo /home/pi/openhab/start.sh &


exit 0

Any ideas where the problem can be?