Bitcoin Forum
May 07, 2024, 04:29:37 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: JK's Application and system rebooter v1.0  (Read 132 times)
JaredKaragen (OP)
Legendary
*
Offline Offline

Activity: 1848
Merit: 1165


My AR-15 ID's itself as a toaster. Want breakfast?


View Profile WWW
November 04, 2018, 07:41:50 PM
 #1

Ok,

  Another small utility I whipped up the other day.     I was having stability issues with xmr-stak; as well as wanting to have a clean auto-reboot mechanism in my miners.   Nowadays I tend to use teamviewer to track all of my devices and have easy access, but it tends to have strange crashes and not respond every now and then.   So;  two birds with one stone.     I don't use windows task scheduler.... it is... unreliable at best.

This simple batch file can be used to reset your process periodically, and set a system reboot timer as well.

Feel free to hack and splice this any way you wish;  Just remember;  if you incorporate it;  just give credit where credit is due as everyone should.

I do not ask for donations for my work.   But if you feel so inclined, there's a tiny donation address that can be found via the batch link in my signature.

rebooter.bat
Code:
@echo off
REM     JK's Application and system rebooter v1.0 11/04/2018
REM     AP is the program's filename that you wish to run and kill periodically.  AL is the long launch string;  using a separate a batch file containing that is preferable, but not necessary.
SET AL=xmr-stak.exe
SET AP=xmr-stak.exe
REM     A is the base counter for keeping track of when we started.
REM     C1 is the amount of seconds between each application restart. (default 7200; 2 hours)
REM     C2 is the amount of seconds between each system reboot. (default 86400; 24 hours)
SET /A A=0
SET /A C1=7200
SET /A C2=86400
:START
REM     Some fancy math for the text readout.
SET /A B=%A%/%C1%
SET /A C=%C2%-%A%
SET /A D=%C%/3600
ECHO JK's Rebooter v1.0
ECHO Executing: %AP%
ECHO Number of application restarts: %B%
ECHO Projected next system reboot in %D% hours.
REM     Start our program
START "%AP%" %AL%
ECHO Waiting...
REM     Wait 2 hours for a keypress that will never happen and increment the counter
CHOICE /c ú /n /t %C1% /d ú
SET /A A=%A%+%C1%
REM     If the counter is greater than or equal to our C2 reboot counter, reboot the machine.  Comment out this next line if you don't want complete system reboots.
IF A GEQ %C2% reboot /r
REM     Otherwise just kill our process and go back up to where it starts again because our timer ran out.
TASKKILL /F /IM %AP%
REM     Wait 1 second to let the app close up.   It's not necessary, but a smart thing to do.
CHOICE /c ú /n /t 2 /d ú
CLS
GOTO START

Link to my batch and script resources here.  

DO NOT TRUST YOBIT  -JK

Donations: 1Q8HjG8wMa3hgmDFbFHC9cADPLpm1xKHQM
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!