Automatic Zennoposter recovery after crash or hello healthy sleep
ATTENTION !!!
We take part in the article contest by Zennolab and we ask all our customers to vote for us.
To vote you must own at least one of these licenses: Zennoposter, Proxy Checker or CapMonster and have Client status on Zennolab forum.
If you do not have this status but you have purchased any of these products e-mail to
[email protected] with email indicating your license.
Everyone who will vote for us will get a nice bonus.
In order to get it send email to [email protected] with the subject "I Want Bonus"
Claim your reward before 31.12.2014
Title of the article is in russian "Автоматическая реанимация Zennoposter после падения или здравствуй здоровый сон "
http://zennolab.com/discussion/threads/golosovanie.17318/
Many Zennoposter active users experiencing such problem time to time - software has been launched, tasks configured and went to rest with the idea that the software itself will do everything and in the morning you wake up and you will enjoy the result. But in the morning it turns out that the Zennoposter worked an hour or two and decided that it also need rest and dropped dead. As a result, sever and proxy downtime, angry clients or just your personal frustration.
This solution is especially helpful if you have Zennoposter running on the dedicated server or vps and you do not have time or opportunity to constantly monitor what is happening there, and whether the program is working or not.
How how do you handle such situation?
Solution is quiete simple and elegant.
We're going to need a BAT file with such content.
@echo off
SETLOCAL EnableExtensions
set EXE=ZennoPoster.exe
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND
echo Not running
:: Specify full path to Zennoposter.exe
start "" "C:\Program Files (x86)\ZennoLab\ZennoPoster Pro\Progs\ZennoPoster.exe" -screen 0 -clipboard -multiwindow
exit 0
:FOUND
echo Running
:: Set path to file that will be checked for changes
set "file=D:\search.log"
:: Set required interval in seconds
:: (5 hours = 18000 seconds):
set diff=18000
for %%i in ("%file%") do (
for /f "tokens=1,2" %%j in ("%%~ti") do (
for /f %%l in ('
mshta "vbscript:CreateObject("Scripting.FileSystemObject").GetStandardStream(1).Write(DateDiff("s","%%j"+Chr(32)+"%%k",now))&Close()"
') do (
:: Проверяем, прошло ли установленное время после последнего изменения файла
if %%l gtr %diff% (
taskkill /f /im "ZennoPoster.exe"
start "" "C:\Program Files (x86)\ZennoLab\ZennoPoster Pro\Progs\ZennoPoster.exe" -screen 0 -clipboard -multiwindow )
)
)
)
exit 0
So what this BAT does anyhow?
It's checking - does Zennoposter.exe is running in active processes, if process if found, BAT file will end its execution if not it will launch software all by itself.
Besides this BAT file will also check timestamp of file and time specified in its settings. If specified times is passed and file isn't changed, BAT file will kill Zennoposter in processes and will run it again.
Why do you need this?
For example, BAT file has been launched, software is running.... BUT! There are cases when due to wrong template logic he may just hang up or instance just drops dead and logic will be spinning round and round on bad end and this would require your attention, like interrupt template, or just reboot the software.
To avoid these issues you can set path to file which should be updated during template proper logic execution and won't be updated because to errors, and bat file will check if this file wasn't modfied within specified time frame it will simple reload the software.
After we have created and configured our BAT file, we need a proper tool which will run it time to time and this tool is standard Windows Task Manager which can be found in Control Panel - Administrative Tools - Task Scheduler or just type C:\Windows\system32\taskschd.msc in windows explorer.
Here we create task, set name for it, description, required user which has administrator rights and set checkbox “Run with highest privileges”
Trigger tab
First select frequency of task – daily, weekly, monthly
Advance Settings
Delay up to - Time when trigger will be launched for a the first time
Repeat task every – select required time intervals
Duration – this will determine for how long will scheduler work or indefinitely to keep him going without a stop
“Enable” checkbox should be on.
Actions tab
Select “Start a program” action and set path to created BAT file.
After we finish setup hit OK and Task Scheduler will begin its work.
Congratulations you have done it!
Now it’s time to relax and forget about any issues with Zennoposter stability.