[NF] Create Senml Messages for Linksmart
This commit is contained in:
		
							parent
							
								
									acf5cea593
								
							
						
					
					
						commit
						200420c9b0
					
				
							
								
								
									
										18
									
								
								Zway-Bot.sln
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Zway-Bot.sln
									
									
									
									
									
								
							@ -13,6 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\IoT\U
 | 
				
			|||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj", "{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}"
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj", "{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}"
 | 
				
			||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iot-Interfaces", "..\Utils\IoT\Interfaces\Iot-Interfaces.csproj", "{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}"
 | 
				
			||||||
 | 
					EndProject
 | 
				
			||||||
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}"
 | 
				
			||||||
 | 
					EndProject
 | 
				
			||||||
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "M2Mqtt", "..\Librarys\mqtt\M2Mqtt\M2Mqtt.csproj", "{A11AEF5A-B246-4FE8-8330-06DB73CC8074}"
 | 
				
			||||||
 | 
					EndProject
 | 
				
			||||||
Global
 | 
					Global
 | 
				
			||||||
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
						GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
				
			||||||
		Debug|Any CPU = Debug|Any CPU
 | 
							Debug|Any CPU = Debug|Any CPU
 | 
				
			||||||
@ -39,6 +45,18 @@ Global
 | 
				
			|||||||
		{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
							{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
		{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
							{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
		{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
							{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
 | 
							{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
				
			||||||
 | 
							{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
 | 
							{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
 | 
							{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
 | 
							{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
				
			||||||
 | 
							{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
 | 
							{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
 | 
							{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
 | 
							{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
				
			||||||
 | 
							{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
 | 
							{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
 | 
							{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
	EndGlobalSection
 | 
						EndGlobalSection
 | 
				
			||||||
	GlobalSection(SolutionProperties) = preSolution
 | 
						GlobalSection(SolutionProperties) = preSolution
 | 
				
			||||||
		HideSolutionNode = FALSE
 | 
							HideSolutionNode = FALSE
 | 
				
			||||||
 | 
				
			|||||||
@ -54,6 +54,15 @@ namespace ZwayBot {
 | 
				
			|||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    internal static Boolean HasInterface(this Object o, Type interf) {
 | 
				
			||||||
 | 
					      foreach(Type item in o.GetType().GetInterfaces()) {
 | 
				
			||||||
 | 
					        if(item == interf) {
 | 
				
			||||||
 | 
					          return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    internal static void WriteError(String text) {
 | 
					    internal static void WriteError(String text) {
 | 
				
			||||||
      Console.ForegroundColor = ConsoleColor.Red;
 | 
					      Console.ForegroundColor = ConsoleColor.Red;
 | 
				
			||||||
      Console.Error.WriteLine("ERROR: " + text);
 | 
					      Console.Error.WriteLine("ERROR: " + text);
 | 
				
			||||||
 | 
				
			|||||||
@ -124,10 +124,6 @@ namespace ZwayBot.Moduls {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ~Mqtt() {
 | 
					 | 
				
			||||||
      Dispose(false);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public override void Dispose() {
 | 
					    public override void Dispose() {
 | 
				
			||||||
      Dispose(true);
 | 
					      Dispose(true);
 | 
				
			||||||
      GC.SuppressFinalize(this);
 | 
					      GC.SuppressFinalize(this);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										61
									
								
								Zway-Bot/Moduls/Senml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Zway-Bot/Moduls/Senml.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using BlubbFish.IoT.Zway;
 | 
				
			||||||
 | 
					using BlubbFish.IoT.Zway.Events;
 | 
				
			||||||
 | 
					using BlubbFish.Utils;
 | 
				
			||||||
 | 
					using BlubbFish.Utils.IoT.Connector;
 | 
				
			||||||
 | 
					using BlubbFish.Utils.IoT.Interfaces;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace ZwayBot.Moduls {
 | 
				
			||||||
 | 
					  class Senml : AModul {
 | 
				
			||||||
 | 
					    public override event ModulEvent Update;
 | 
				
			||||||
 | 
					    private ADataBackend mqtt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Senml(ZwayController zway, InIReader settings) : base(zway, settings) {
 | 
				
			||||||
 | 
					      if (this.config.ContainsKey("settings")) {
 | 
				
			||||||
 | 
					        this.mqtt = ADataBackend.GetInstance(this.config["settings"]);
 | 
				
			||||||
 | 
					        this.mqtt.MessageIncomming += this.EventInput;
 | 
				
			||||||
 | 
					        this.zw.Update += this.EventOutput;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #region Events
 | 
				
			||||||
 | 
					    private void EventOutput(Object sender, DeviceUpdateEvent e) {
 | 
				
			||||||
 | 
					      String topic = "";
 | 
				
			||||||
 | 
					      String data = "";
 | 
				
			||||||
 | 
					      if (e.Parent.HasInterface(typeof(ISenml))) {
 | 
				
			||||||
 | 
					        ISenml sensor = (ISenml)e.Parent;
 | 
				
			||||||
 | 
					        topic = "/senml/" + sensor.SenmlTopic();
 | 
				
			||||||
 | 
					        data = sensor.ToSenml();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      if (topic != "" && data != "") {
 | 
				
			||||||
 | 
					        this.mqtt.Send(topic, data);
 | 
				
			||||||
 | 
					        this.Update?.Invoke(this, new MqttEvent(topic, data));
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void EventInput(Object sender, MqttEventArgs e) { }
 | 
				
			||||||
 | 
					    #endregion
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    #region Config
 | 
				
			||||||
 | 
					    protected override void UpdateConfig() { }
 | 
				
			||||||
 | 
					    #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #region IDisposable Support
 | 
				
			||||||
 | 
					    private Boolean disposedValue = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected virtual void Dispose(Boolean disposing) {
 | 
				
			||||||
 | 
					      if (!this.disposedValue) {
 | 
				
			||||||
 | 
					        if (disposing) {
 | 
				
			||||||
 | 
					          this.mqtt.Dispose();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        this.disposedValue = true;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public override void Dispose() {
 | 
				
			||||||
 | 
					      Dispose(true);
 | 
				
			||||||
 | 
					      GC.SuppressFinalize(this);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    #endregion
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -39,9 +39,6 @@
 | 
				
			|||||||
    <ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
 | 
					    <ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <Reference Include="LitJson, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
 | 
					 | 
				
			||||||
      <HintPath>..\packages\LitJson.0.9.0\lib\LitJson.dll</HintPath>
 | 
					 | 
				
			||||||
    </Reference>
 | 
					 | 
				
			||||||
    <Reference Include="System" />
 | 
					    <Reference Include="System" />
 | 
				
			||||||
    <Reference Include="System.Core" />
 | 
					    <Reference Include="System.Core" />
 | 
				
			||||||
    <Reference Include="System.Drawing" />
 | 
					    <Reference Include="System.Drawing" />
 | 
				
			||||||
@ -60,6 +57,7 @@
 | 
				
			|||||||
    <Compile Include="Helper.cs" />
 | 
					    <Compile Include="Helper.cs" />
 | 
				
			||||||
    <Compile Include="Moduls\Mqtt.cs" />
 | 
					    <Compile Include="Moduls\Mqtt.cs" />
 | 
				
			||||||
    <Compile Include="Moduls\Overtaker.cs" />
 | 
					    <Compile Include="Moduls\Overtaker.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Moduls\Senml.cs" />
 | 
				
			||||||
    <Compile Include="Moduls\StatusPolling.cs" />
 | 
					    <Compile Include="Moduls\StatusPolling.cs" />
 | 
				
			||||||
    <Compile Include="Program.cs" />
 | 
					    <Compile Include="Program.cs" />
 | 
				
			||||||
    <Compile Include="Properties\AssemblyInfo.cs" />
 | 
					    <Compile Include="Properties\AssemblyInfo.cs" />
 | 
				
			||||||
@ -70,10 +68,18 @@
 | 
				
			|||||||
    </Compile>
 | 
					    </Compile>
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <ProjectReference Include="..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj">
 | 
				
			||||||
 | 
					      <Project>{91a14cd2-2940-4500-8193-56d37edddbaa}</Project>
 | 
				
			||||||
 | 
					      <Name>litjson_4.7.1</Name>
 | 
				
			||||||
 | 
					    </ProjectReference>
 | 
				
			||||||
    <ProjectReference Include="..\..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj">
 | 
					    <ProjectReference Include="..\..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj">
 | 
				
			||||||
      <Project>{ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2}</Project>
 | 
					      <Project>{ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2}</Project>
 | 
				
			||||||
      <Name>ConnectorDataMqtt</Name>
 | 
					      <Name>ConnectorDataMqtt</Name>
 | 
				
			||||||
    </ProjectReference>
 | 
					    </ProjectReference>
 | 
				
			||||||
 | 
					    <ProjectReference Include="..\..\Utils\IoT\Interfaces\Iot-Interfaces.csproj">
 | 
				
			||||||
 | 
					      <Project>{4daada29-c600-4cf3-8ad3-9c97c8d7f632}</Project>
 | 
				
			||||||
 | 
					      <Name>Iot-Interfaces</Name>
 | 
				
			||||||
 | 
					    </ProjectReference>
 | 
				
			||||||
    <ProjectReference Include="..\..\Utils\IoT\Utils-IoT.csproj">
 | 
					    <ProjectReference Include="..\..\Utils\IoT\Utils-IoT.csproj">
 | 
				
			||||||
      <Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
 | 
					      <Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
 | 
				
			||||||
      <Name>Utils-IoT</Name>
 | 
					      <Name>Utils-IoT</Name>
 | 
				
			||||||
@ -88,7 +94,33 @@
 | 
				
			|||||||
    </ProjectReference>
 | 
					    </ProjectReference>
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <None Include="packages.config" />
 | 
					    <None Include="control\control.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\join.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\loop.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\restart.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\settings.cfg">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\start.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\stop.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\stuff.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Include="control\view.sh">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <None Include="Resources\Icon.ico" />
 | 
					    <None Include="Resources\Icon.ico" />
 | 
				
			||||||
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Zway-Bot/bin/Release/Iot-Interfaces.dll
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Zway-Bot/bin/Release/Iot-Interfaces.dll
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Zway-Bot/bin/Release/M2Mqtt.dll
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Zway-Bot/bin/Release/M2Mqtt.dll
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										92
									
								
								Zway-Bot/bin/Release/control/control.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										92
									
								
								Zway-Bot/bin/Release/control/control.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,92 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					cd $control_root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for(( ; ; ))
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
					  # Test for Running Servers
 | 
				
			||||||
 | 
					  servers=$(./view.sh | grep $screen_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  clear
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if [[ -z $servers ]];
 | 
				
			||||||
 | 
					  then
 | 
				
			||||||
 | 
					    echo "Hut-Botr not Running!"
 | 
				
			||||||
 | 
					    echo ""
 | 
				
			||||||
 | 
					    echo "1) Start Hut-Bot"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    echo "Hut-Bot is Running :)"
 | 
				
			||||||
 | 
					    echo ""
 | 
				
			||||||
 | 
					    echo "2) Stop Hut-Bot"
 | 
				
			||||||
 | 
					    echo "3) Restart Hut-Bot"
 | 
				
			||||||
 | 
					    echo "4) Attach to Servers Screen-Session"
 | 
				
			||||||
 | 
					    echo "5) Put Command to Hut-Bot"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  echo "q) Quit"
 | 
				
			||||||
 | 
					  echo ""
 | 
				
			||||||
 | 
					  read -p "Choice: " choice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  case "$choice" in
 | 
				
			||||||
 | 
					    q) #Quit
 | 
				
			||||||
 | 
					      exit 0
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					    1) #Start Server
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Starting Hut-Bot..."
 | 
				
			||||||
 | 
					        ./start.sh
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        echo "Hut-Bot Allready started!"
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    2) #Stop Server
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        echo "Stopping Hut-Bot..."
 | 
				
			||||||
 | 
					        ./stop.sh
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    3) #Restart Server
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        echo "Restarting Hut-Bot..."
 | 
				
			||||||
 | 
					        ./restart.sh
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    4) #Attach to Screen
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        ./join.sh
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    5) #Put Command to Server
 | 
				
			||||||
 | 
					     if [[ -z $servers ]];
 | 
				
			||||||
 | 
					     then
 | 
				
			||||||
 | 
					       echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					     else
 | 
				
			||||||
 | 
					       read -p "Please enter Hut-Bot-Command: " mc_cmd
 | 
				
			||||||
 | 
					       ./stuff.sh "$mc_cmd"
 | 
				
			||||||
 | 
					     fi
 | 
				
			||||||
 | 
					     ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    *) #Invalid Selection
 | 
				
			||||||
 | 
					      echo "Wrong Selection!"
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					  esac
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
							
								
								
									
										10
									
								
								Zway-Bot/bin/Release/control/join.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								Zway-Bot/bin/Release/control/join.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo Press STRG+A then D to detach from Console
 | 
				
			||||||
 | 
					read -p "Press [Enter] to continue..."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					screen -R $screen_name
 | 
				
			||||||
							
								
								
									
										21
									
								
								Zway-Bot/bin/Release/control/loop.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								Zway-Bot/bin/Release/control/loop.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rm $control_root/stop_server.info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for(( ; ; ))
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
					  if [ ! -e $control_root/stop_server.info ];
 | 
				
			||||||
 | 
					  then
 | 
				
			||||||
 | 
					    cd $mc_root
 | 
				
			||||||
 | 
					    $mc_cmd
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    echo "Stopped Server!"
 | 
				
			||||||
 | 
					    break
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rm $control_root/stop_server.info
 | 
				
			||||||
							
								
								
									
										28
									
								
								Zway-Bot/bin/Release/control/restart.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								Zway-Bot/bin/Release/control/restart.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					cd $control_root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Be Shure theere is no Stop-Info
 | 
				
			||||||
 | 
					rm $control_root/stop_server.info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Server will be restarted in 5 Seconds..."
 | 
				
			||||||
 | 
					./stuff.sh "/say ReStarting Server in 5 seconds!"
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "4..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 4..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "3..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 3..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "2..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 2..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "1..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 1..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "Restarting Server..."
 | 
				
			||||||
 | 
					./stuff.sh "/say Restart Now!"
 | 
				
			||||||
 | 
					./stuff.sh "stop"
 | 
				
			||||||
							
								
								
									
										23
									
								
								Zway-Bot/bin/Release/control/settings.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Zway-Bot/bin/Release/control/settings.cfg
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					# Minecraft Control-Scripts Config-File
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# (please remember that there are no spaces allowed around the =-Sign
 | 
				
			||||||
 | 
					#  in the config-lines)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Minecraft-Dir & JAR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Directory where minecraft is in
 | 
				
			||||||
 | 
					mc_root="/home/pi/Zway-Bot"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Root of Control-Scripts
 | 
				
			||||||
 | 
					control_root="$mc_root/control"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# MC-Server-Jar (will be executed in mc_root)
 | 
				
			||||||
 | 
					mc_jar="$mc_root/Hue-Zway.exe"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# MC-Server Start-Command
 | 
				
			||||||
 | 
					mc_cmd="mono $mc_jar"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Screen
 | 
				
			||||||
 | 
					screen_name="Hue-Zway"
 | 
				
			||||||
							
								
								
									
										14
									
								
								Zway-Bot/bin/Release/control/start.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								Zway-Bot/bin/Release/control/start.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Start Loop in Screen
 | 
				
			||||||
 | 
					screen -A -m -d -S $screen_name $control_root/loop.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Allow other users to control this screen-Session!
 | 
				
			||||||
 | 
					screen -r $screen_name -X multiuser on
 | 
				
			||||||
 | 
					screen -r $screen_name -X addacl www-data
 | 
				
			||||||
 | 
					screen -r $screen_name -X addacl mc
 | 
				
			||||||
 | 
					screen -r $screen_name -X addacl mw
 | 
				
			||||||
							
								
								
									
										29
									
								
								Zway-Bot/bin/Release/control/stop.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								Zway-Bot/bin/Release/control/stop.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					cd $control_root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Create Stop-Info!
 | 
				
			||||||
 | 
					touch $control_root/stop_server.info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Shutting Down Server in 5 Seconds!"
 | 
				
			||||||
 | 
					./stuff.sh "/say Shutting Down Server in 5 Seconds!"
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "4..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 4..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "3..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 3..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "2..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 2..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "1..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 1..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "Shuting Down Server..."
 | 
				
			||||||
 | 
					./stuff.sh "/say Shutdown Now!"
 | 
				
			||||||
 | 
					./stuff.sh "stop"
 | 
				
			||||||
 | 
					screen -R $screen_name
 | 
				
			||||||
							
								
								
									
										10
									
								
								Zway-Bot/bin/Release/control/stuff.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								Zway-Bot/bin/Release/control/stuff.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# screen -r $screen_name -X stuff "$1\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					screen -p 0 -S $screen_name -X eval "stuff '$1'\015"
 | 
				
			||||||
 | 
					# as_user "screen -p 0 -S minecraft -X eval 'stuff \"$command\"\015'"
 | 
				
			||||||
							
								
								
									
										3
									
								
								Zway-Bot/bin/Release/control/view.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								Zway-Bot/bin/Release/control/view.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					screen -ls
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								Zway-Bot/bin/Release/litjson.dll
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Zway-Bot/bin/Release/litjson.dll
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										92
									
								
								Zway-Bot/control/control.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								Zway-Bot/control/control.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,92 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					cd $control_root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for(( ; ; ))
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
					  # Test for Running Servers
 | 
				
			||||||
 | 
					  servers=$(./view.sh | grep $screen_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  clear
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if [[ -z $servers ]];
 | 
				
			||||||
 | 
					  then
 | 
				
			||||||
 | 
					    echo "Hut-Botr not Running!"
 | 
				
			||||||
 | 
					    echo ""
 | 
				
			||||||
 | 
					    echo "1) Start Hut-Bot"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    echo "Hut-Bot is Running :)"
 | 
				
			||||||
 | 
					    echo ""
 | 
				
			||||||
 | 
					    echo "2) Stop Hut-Bot"
 | 
				
			||||||
 | 
					    echo "3) Restart Hut-Bot"
 | 
				
			||||||
 | 
					    echo "4) Attach to Servers Screen-Session"
 | 
				
			||||||
 | 
					    echo "5) Put Command to Hut-Bot"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  echo "q) Quit"
 | 
				
			||||||
 | 
					  echo ""
 | 
				
			||||||
 | 
					  read -p "Choice: " choice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  case "$choice" in
 | 
				
			||||||
 | 
					    q) #Quit
 | 
				
			||||||
 | 
					      exit 0
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					    1) #Start Server
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Starting Hut-Bot..."
 | 
				
			||||||
 | 
					        ./start.sh
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        echo "Hut-Bot Allready started!"
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    2) #Stop Server
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        echo "Stopping Hut-Bot..."
 | 
				
			||||||
 | 
					        ./stop.sh
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    3) #Restart Server
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        echo "Restarting Hut-Bot..."
 | 
				
			||||||
 | 
					        ./restart.sh
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    4) #Attach to Screen
 | 
				
			||||||
 | 
					      if [[ -z $servers ]];
 | 
				
			||||||
 | 
					      then
 | 
				
			||||||
 | 
					        echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        ./join.sh
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    5) #Put Command to Server
 | 
				
			||||||
 | 
					     if [[ -z $servers ]];
 | 
				
			||||||
 | 
					     then
 | 
				
			||||||
 | 
					       echo "Hut-Bot is not Running!"
 | 
				
			||||||
 | 
					     else
 | 
				
			||||||
 | 
					       read -p "Please enter Hut-Bot-Command: " mc_cmd
 | 
				
			||||||
 | 
					       ./stuff.sh "$mc_cmd"
 | 
				
			||||||
 | 
					     fi
 | 
				
			||||||
 | 
					     ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    *) #Invalid Selection
 | 
				
			||||||
 | 
					      echo "Wrong Selection!"
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
 | 
					  esac
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
							
								
								
									
										10
									
								
								Zway-Bot/control/join.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Zway-Bot/control/join.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo Press STRG+A then D to detach from Console
 | 
				
			||||||
 | 
					read -p "Press [Enter] to continue..."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					screen -R $screen_name
 | 
				
			||||||
							
								
								
									
										21
									
								
								Zway-Bot/control/loop.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Zway-Bot/control/loop.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rm $control_root/stop_server.info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for(( ; ; ))
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
					  if [ ! -e $control_root/stop_server.info ];
 | 
				
			||||||
 | 
					  then
 | 
				
			||||||
 | 
					    cd $mc_root
 | 
				
			||||||
 | 
					    $mc_cmd
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    echo "Stopped Server!"
 | 
				
			||||||
 | 
					    break
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rm $control_root/stop_server.info
 | 
				
			||||||
							
								
								
									
										28
									
								
								Zway-Bot/control/restart.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Zway-Bot/control/restart.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					cd $control_root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Be Shure theere is no Stop-Info
 | 
				
			||||||
 | 
					rm $control_root/stop_server.info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Server will be restarted in 5 Seconds..."
 | 
				
			||||||
 | 
					./stuff.sh "/say ReStarting Server in 5 seconds!"
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "4..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 4..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "3..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 3..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "2..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 2..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "1..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 1..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "Restarting Server..."
 | 
				
			||||||
 | 
					./stuff.sh "/say Restart Now!"
 | 
				
			||||||
 | 
					./stuff.sh "stop"
 | 
				
			||||||
							
								
								
									
										23
									
								
								Zway-Bot/control/settings.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Zway-Bot/control/settings.cfg
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					# Minecraft Control-Scripts Config-File
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# (please remember that there are no spaces allowed around the =-Sign
 | 
				
			||||||
 | 
					#  in the config-lines)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Minecraft-Dir & JAR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Directory where minecraft is in
 | 
				
			||||||
 | 
					mc_root="/home/pi/Zway-Bot"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Root of Control-Scripts
 | 
				
			||||||
 | 
					control_root="$mc_root/control"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# MC-Server-Jar (will be executed in mc_root)
 | 
				
			||||||
 | 
					mc_jar="$mc_root/Hue-Zway.exe"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# MC-Server Start-Command
 | 
				
			||||||
 | 
					mc_cmd="mono $mc_jar"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Screen
 | 
				
			||||||
 | 
					screen_name="Hue-Zway"
 | 
				
			||||||
							
								
								
									
										14
									
								
								Zway-Bot/control/start.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Zway-Bot/control/start.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Start Loop in Screen
 | 
				
			||||||
 | 
					screen -A -m -d -S $screen_name $control_root/loop.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Allow other users to control this screen-Session!
 | 
				
			||||||
 | 
					screen -r $screen_name -X multiuser on
 | 
				
			||||||
 | 
					screen -r $screen_name -X addacl www-data
 | 
				
			||||||
 | 
					screen -r $screen_name -X addacl mc
 | 
				
			||||||
 | 
					screen -r $screen_name -X addacl mw
 | 
				
			||||||
							
								
								
									
										29
									
								
								Zway-Bot/control/stop.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Zway-Bot/control/stop.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					cd $control_root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Create Stop-Info!
 | 
				
			||||||
 | 
					touch $control_root/stop_server.info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Shutting Down Server in 5 Seconds!"
 | 
				
			||||||
 | 
					./stuff.sh "/say Shutting Down Server in 5 Seconds!"
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "4..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 4..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "3..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 3..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "2..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 2..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "1..."
 | 
				
			||||||
 | 
					./stuff.sh "/say 1..."
 | 
				
			||||||
 | 
					sleep 1
 | 
				
			||||||
 | 
					echo "Shuting Down Server..."
 | 
				
			||||||
 | 
					./stuff.sh "/say Shutdown Now!"
 | 
				
			||||||
 | 
					./stuff.sh "stop"
 | 
				
			||||||
 | 
					screen -R $screen_name
 | 
				
			||||||
							
								
								
									
										10
									
								
								Zway-Bot/control/stuff.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Zway-Bot/control/stuff.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Read Settings
 | 
				
			||||||
 | 
					DIR=`dirname $0`
 | 
				
			||||||
 | 
					source $DIR/settings.cfg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# screen -r $screen_name -X stuff "$1\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					screen -p 0 -S $screen_name -X eval "stuff '$1'\015"
 | 
				
			||||||
 | 
					# as_user "screen -p 0 -S minecraft -X eval 'stuff \"$command\"\015'"
 | 
				
			||||||
							
								
								
									
										3
									
								
								Zway-Bot/control/view.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Zway-Bot/control/view.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					screen -ls
 | 
				
			||||||
@ -1,4 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					 | 
				
			||||||
<packages>
 | 
					 | 
				
			||||||
  <package id="LitJson" version="0.9.0" targetFramework="net461" />
 | 
					 | 
				
			||||||
</packages>
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user