Compare commits

...
6 Commits
Author SHA1 Message Date
BlubbFish 1c84703ac6 [BF] Making service linux running 2018-06-02 18:41:21 +00:00
BlubbFish 25e1e5165d 2018-06-02 17:14:42 +00:00
BlubbFish a76234f43d 2018-06-01 18:23:30 +00:00
BlubbFish a3afadd5f5 [NF] Move 2018-05-31 18:03:57 +00:00
BlubbFish 002b3cf338 [NF] Logrotate 2018-05-29 20:07:50 +00:00
BlubbFish a7895ef59a 2018-05-29 16:15:17 +00:00
44 changed files with 90 additions and 520 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ using BlubbFish.Utils;
namespace ZwayBot { namespace ZwayBot {
abstract class AModul { abstract class AModul {
protected ZwayController zw; protected ZwayController zw;
private InIReader settings; private readonly InIReader settings;
protected Dictionary<String, Dictionary<String, String>> config = new Dictionary<String, Dictionary<String, String>>(); protected Dictionary<String, Dictionary<String, String>> config = new Dictionary<String, Dictionary<String, String>>();
public Boolean HasConfig { get; private set; } public Boolean HasConfig { get; private set; }
+2 -8
View File
@@ -16,7 +16,7 @@ namespace ZwayBot.Moduls {
public override event ModulEvent Update; public override event ModulEvent Update;
private Dictionary<String, String> cron_named = new Dictionary<String, String> { private readonly Dictionary<String, String> cron_named = new Dictionary<String, String> {
{ "@yearly", "0 0 1 1 *" }, { "@yearly", "0 0 1 1 *" },
{ "@annually", "0 0 1 1 *" }, { "@annually", "0 0 1 1 *" },
{ "@monthly", "0 0 1 * *" }, { "@monthly", "0 0 1 * *" },
@@ -166,19 +166,13 @@ namespace ZwayBot.Moduls {
if (!this.disposedValue) { if (!this.disposedValue) {
if (disposing) { if (disposing) {
this.thread.Abort(); this.thread.Abort();
while(this.thread.ThreadState != ThreadState.Aborted) { Thread.Sleep(100); } while(this.thread.ThreadState == ThreadState.Running) { Thread.Sleep(100); }
} }
this.thread = null; this.thread = null;
this.disposedValue = true; this.disposedValue = true;
} }
} }
~CronJob() {
Dispose(false);
}
public override void Dispose() { public override void Dispose() {
Dispose(true); Dispose(true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
+1 -1
View File
@@ -11,7 +11,7 @@ using LitJson;
namespace ZwayBot.Moduls { namespace ZwayBot.Moduls {
class Mqtt : AModul, IDisposable { class Mqtt : AModul, IDisposable {
private ABackend mqtt; private readonly ABackend mqtt;
private Dictionary<String, AModul> modules; private Dictionary<String, AModul> modules;
public override event ModulEvent Update; public override event ModulEvent Update;
+1 -5
View File
@@ -7,7 +7,7 @@ using BlubbFish.Utils;
namespace ZwayBot.Moduls { namespace ZwayBot.Moduls {
internal class Overtaker : AModul, IDisposable { internal class Overtaker : AModul, IDisposable {
private Dictionary<String, Dictionary<String, String>> events = new Dictionary<String, Dictionary<String, String>>(); private readonly Dictionary<String, Dictionary<String, String>> events = new Dictionary<String, Dictionary<String, String>>();
public override event ModulEvent Update; public override event ModulEvent Update;
@@ -89,10 +89,6 @@ namespace ZwayBot.Moduls {
} }
} }
~Overtaker() {
Dispose(false);
}
public override void Dispose() { public override void Dispose() {
Dispose(true); Dispose(true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
+2 -2
View File
@@ -9,8 +9,8 @@ using BlubbFish.Utils.IoT.Interfaces;
namespace ZwayBot.Moduls { namespace ZwayBot.Moduls {
class Senml : AModul { class Senml : AModul {
public override event ModulEvent Update; public override event ModulEvent Update;
private ABackend mqtt; private readonly ABackend mqtt;
private String SenmlGuid; private readonly String SenmlGuid;
public Senml(ZwayController zway, InIReader settings) : base(zway, settings) { public Senml(ZwayController zway, InIReader settings) : base(zway, settings) {
if (this.config.ContainsKey("settings")) { if (this.config.ContainsKey("settings")) {
+16 -4
View File
@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Threading;
using BlubbFish.IoT.Zway; using BlubbFish.IoT.Zway;
using BlubbFish.Utils; using BlubbFish.Utils;
@@ -11,7 +12,7 @@ namespace ZwayBot {
private readonly ZwayController zw; private readonly ZwayController zw;
private readonly Dictionary<String, AModul> moduls = new Dictionary<String, AModul>(); private readonly Dictionary<String, AModul> moduls = new Dictionary<String, AModul>();
private Boolean RunningProcess = true; private Boolean RunningProcess = true;
private System.Threading.Thread sig_thread; private Thread sig_thread;
private readonly ProgramLogger logger = new ProgramLogger(); private readonly ProgramLogger logger = new ProgramLogger();
public Program(String[] args) { public Program(String[] args) {
@@ -43,24 +44,33 @@ namespace ZwayBot {
} }
private void WaitForShutdown() { private void WaitForShutdown() {
this.sig_thread = new System.Threading.Thread(delegate() { if (Type.GetType("Mono.Runtime") != null) {
this.sig_thread = new Thread(delegate () {
Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[] { Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[] {
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM), new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM),
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT) new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT)
}; };
Console.WriteLine("Signalhandler Mono attached.");
while (true) { while (true) {
Int32 i = Mono.Unix.UnixSignal.WaitAny(signals, -1); Int32 i = Mono.Unix.UnixSignal.WaitAny(signals, -1);
this.RunningProcess = false; Console.WriteLine("Signalhandler Mono INT recieved " + i + ".");
this.RunningProcess = false; // TODO BUG
break;
} }
}); });
this.sig_thread.Start();
} else {
Console.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown); Console.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown);
Console.WriteLine("Signalhandler Windows attached.");
}
while (this.RunningProcess) { while (this.RunningProcess) {
System.Threading.Thread.Sleep(100); Thread.Sleep(100);
} }
} }
private void SetupShutdown(Object sender, ConsoleCancelEventArgs e) { private void SetupShutdown(Object sender, ConsoleCancelEventArgs e) {
e.Cancel = true; e.Cancel = true;
Console.WriteLine("Signalhandler Windows INT recieved.");
this.RunningProcess = false; this.RunningProcess = false;
} }
@@ -70,8 +80,10 @@ namespace ZwayBot {
Console.WriteLine("Modul entladen: " + item.Key); Console.WriteLine("Modul entladen: " + item.Key);
} }
this.zw.Dispose(); this.zw.Dispose();
if (this.sig_thread != null && this.sig_thread.IsAlive) {
this.sig_thread.Abort(); this.sig_thread.Abort();
} }
}
private void ModulEvents() { private void ModulEvents() {
foreach (KeyValuePair<String, AModul> item in this.moduls) { foreach (KeyValuePair<String, AModul> item in this.moduls) {
+2 -2
View File
@@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.3")] [assembly: AssemblyVersion("1.5.3")]
[assembly: AssemblyFileVersion("1.4.3")] [assembly: AssemblyFileVersion("1.5.3")]
[assembly: NeutralResourcesLanguage("de-DE")] [assembly: NeutralResourcesLanguage("de-DE")]
// “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com. // “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com.
+1 -27
View File
@@ -98,33 +98,6 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<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>
<None Include="config-example\cronjob.conf.example"> <None Include="config-example\cronjob.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -152,6 +125,7 @@
<None Include="dpkg\create-Builds.bat" /> <None Include="dpkg\create-Builds.bat" />
<None Include="dpkg\make-deb.sh" /> <None Include="dpkg\make-deb.sh" />
<None Include="dpkg\prerm" /> <None Include="dpkg\prerm" />
<None Include="dpkg\zwaybot-logrotate" />
<None Include="dpkg\zwaybot.service" /> <None Include="dpkg\zwaybot.service" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Resources\Icon.ico" /> <None Include="Resources\Icon.ico" />
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-92
View File
@@ -1,92 +0,0 @@
#!/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 "Zway-Bot not Running!"
echo ""
echo "1) Start Zway-Bot"
else
echo "Zway-Bot is Running :)"
echo ""
echo "2) Stop Zway-Bot"
echo "3) Restart Zway-Bot"
echo "4) Attach to Servers Screen-Session"
echo "5) Put Command to Zway-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 Zway-Bot..."
./start.sh
else
echo "Zway-Bot Allready started!"
fi
;;
2) #Stop Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
echo "Stopping Zway-Bot..."
./stop.sh
fi
;;
3) #Restart Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
echo "Restarting Zway-Bot..."
./restart.sh
fi
;;
4) #Attach to Screen
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
./join.sh
fi
;;
5) #Put Command to Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
read -p "Please enter Zway-Bot-Command: " mc_cmd
./stuff.sh "$mc_cmd"
fi
;;
*) #Invalid Selection
echo "Wrong Selection!"
;;
esac
done
-10
View File
@@ -1,10 +0,0 @@
#!/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
View File
@@ -1,21 +0,0 @@
#!/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
View File
@@ -1,28 +0,0 @@
#!/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
View File
@@ -1,23 +0,0 @@
#!/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/Zway-Bot.exe"
# MC-Server Start-Command
mc_cmd="mono $mc_jar"
# Screen
screen_name="Zway-Bot"
-14
View File
@@ -1,14 +0,0 @@
#!/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
-13
View File
@@ -1,13 +0,0 @@
#!/bin/bash
# Read Settings
DIR=`dirname $0`
source $DIR/settings.cfg
cd $control_root
# Create Stop-Info!
touch $control_root/stop_server.info
echo "Shuting Down Server..."
./stuff.sh "/exit"
screen -R $screen_name
-10
View File
@@ -1,10 +0,0 @@
#!/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
View File
@@ -1,3 +0,0 @@
#!/bin/bash
screen -ls
Binary file not shown.
-92
View File
@@ -1,92 +0,0 @@
#!/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 "Zway-Bot not Running!"
echo ""
echo "1) Start Zway-Bot"
else
echo "Zway-Bot is Running :)"
echo ""
echo "2) Stop Zway-Bot"
echo "3) Restart Zway-Bot"
echo "4) Attach to Servers Screen-Session"
echo "5) Put Command to Zway-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 Zway-Bot..."
./start.sh
else
echo "Zway-Bot Allready started!"
fi
;;
2) #Stop Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
echo "Stopping Zway-Bot..."
./stop.sh
fi
;;
3) #Restart Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
echo "Restarting Zway-Bot..."
./restart.sh
fi
;;
4) #Attach to Screen
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
./join.sh
fi
;;
5) #Put Command to Server
if [[ -z $servers ]];
then
echo "Zway-Bot is not Running!"
else
read -p "Please enter Zway-Bot-Command: " mc_cmd
./stuff.sh "$mc_cmd"
fi
;;
*) #Invalid Selection
echo "Wrong Selection!"
;;
esac
done
-10
View File
@@ -1,10 +0,0 @@
#!/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
View File
@@ -1,21 +0,0 @@
#!/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
View File
@@ -1,28 +0,0 @@
#!/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
View File
@@ -1,23 +0,0 @@
#!/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/Zway-Bot.exe"
# MC-Server Start-Command
mc_cmd="mono $mc_jar"
# Screen
screen_name="Zway-Bot"
-14
View File
@@ -1,14 +0,0 @@
#!/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
-13
View File
@@ -1,13 +0,0 @@
#!/bin/bash
# Read Settings
DIR=`dirname $0`
source $DIR/settings.cfg
cd $control_root
# Create Stop-Info!
touch $control_root/stop_server.info
echo "Shuting Down Server..."
./stuff.sh "/exit"
screen -R $screen_name
-10
View File
@@ -1,10 +0,0 @@
#!/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
View File
@@ -1,3 +0,0 @@
#!/bin/bash
screen -ls
+1 -6
View File
@@ -1,6 +1 @@
set /P maj=Enter Major Version: bash.exe -c "./make-deb.sh armhf"
set /P min=Enter Minor Version:
set /P bui=Enter Build Version:
bash.exe -c "./make-deb.sh %maj% %min% %bui% armhf"
pause
+23 -11
View File
@@ -1,20 +1,25 @@
#!/bin/bash #!/bin/bash
WORKDIR="/home/blubb"
ROOT="$WORKDIR/deb" HOMEDIR="/home/blubb"
ROOT="$HOMEDIR/deb"
OUTPUT="../bin/Release" OUTPUT="../bin/Release"
EXEC="$ROOT/usr/local/bin/zwaybot" EXEC="$ROOT/usr/local/bin/zwaybot"
CONFIG="$ROOT/etc/zwaybot" CONFIG="$ROOT/etc/zwaybot"
SYSTEMD="$ROOT/etc/systemd/system" SYSTEMD="$ROOT/etc/systemd/system"
LOGROTATE="$ROOT/etc/logrotate.d"
DEBIAN="$ROOT/DEBIAN" DEBIAN="$ROOT/DEBIAN"
VMAJOR=$1 VMAJOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 1)
VMINOR=$2 VMINOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 2)
VBUILD=$3 VBUILD=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 3)
ARCHT=$4 ARCHT=$1
mkdir -p $EXEC mkdir -p $EXEC
mkdir -p $CONFIG mkdir -p $CONFIG
mkdir -p $DEBIAN mkdir -p $DEBIAN
mkdir -p $SYSTEMD mkdir -p $SYSTEMD
mkdir -p $LOGROTATE
cp control $DEBIAN cp control $DEBIAN
cp preinst $DEBIAN cp preinst $DEBIAN
@@ -25,13 +30,20 @@ sed -i s/Architecture:\ any/"Architecture: $ARCHT"/ $DEBIAN/control
chmod 755 $DEBIAN -R chmod 755 $DEBIAN -R
cp zwaybot.service $SYSTEMD cp zwaybot.service $SYSTEMD
chmod 755 $SYSTEMD -R chmod 644 $SYSTEMD/zwaybot.service
cp $OUTPUT/*.exe $EXEC/ cp $OUTPUT/*.exe $EXEC/
cp $OUTPUT/*.dll $EXEC/ find $OUTPUT -name \*.dll ! -name Mono.Posix.dll -exec cp {} $EXEC/ \;
chmod 644 $EXEC/*
chmod 755 $EXEC
cp $OUTPUT/config-example/* $CONFIG cp $OUTPUT/config-example/* $CONFIG
cp $OUTPUT/control $EXEC/ -r chmod 644 $CONFIG/*
chmod 755 $CONFIG
cp zwaybot-logrotate $LOGROTATE/zwaybot
chmod 644 $LOGROTATE/*
dpkg-deb --build $ROOT dpkg-deb --build $ROOT
mv $WORKDIR/deb.deb ../bin/Builds/$ARCHT/"zwaybot_$VMAJOR.$VMINOR-$VBUILD.deb" mv $HOMEDIR/deb.deb ../../../Builds/"$ARCHT-zwaybot_$VMAJOR.$VMINOR-$VBUILD.deb"
rm $WORKDIR/deb -r rm $HOMEDIR/deb -r
+2 -1
View File
@@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
service zwaybot start systemctl daemon-reload
sudo systemctl is-active --quiet zwaybot && service zwaybot restart
+4 -3
View File
@@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
service zwaybot stop useradd -M zwaybot
addgroup zwaybot usermod -L zwaybot
adduser --system --no-create-home --disabled-login --ingroup zwaybot zwaybot groupadd zwaybot
usermod -G zwaybot,adm zwaybot
+10
View File
@@ -0,0 +1,10 @@
/var/log/zwaybot.log {
compress
copytruncate
daily
delaycompress
missingok
notifempty
rotate 4
size=10M
}
+3
View File
@@ -8,9 +8,12 @@ After=network-online.target
User=zwaybot User=zwaybot
Group=zwaybot Group=zwaybot
WorkingDirectory=/usr/local/bin/zwaybot WorkingDirectory=/usr/local/bin/zwaybot
# ExecStartPre=/bin/rm /var/log/zwaybot.log && /bin/touch /var/log/zwaybot.log && /bin/chown zwaybot:zwaybot /var/log/zwaybot.log && /bin/chmod 644 /var/log/zwaybot.log
ExecStart=/usr/bin/mono /usr/local/bin/zwaybot/Zway-Bot.exe ExecStart=/usr/bin/mono /usr/local/bin/zwaybot/Zway-Bot.exe
KillMode=control-group KillMode=control-group
Restart=on-failure Restart=on-failure
StandardOutput=null
StandardError=syslog+journal
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target