Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MICROS 3700 Reboot

Status
Not open for further replies.

djn602

MIS
Oct 9, 2009
14
0
0
US
Hello,

We had our MICROS 3700 have a meltdown yesterday and got a hold of support and they were aghast that it has been up for 30 days! It would have been nice if our dealer would have told us that it should be rebooted once a week. We have had the system for a year and a half. I find it ridiculous that this has to be done but I digress. As far as I understand, the terminals should be rebooted as well. I can do our terminals (standard Windows PCs) via many different routes but the KDS systems are a different story. Is the reboot command that one can find on the MICROS control panel available via command line too? If it is, then this all is a non issue.
 
Well I found this script in two year old post on here. I will reboot the server.

@echo off
D:\MICROS\Res\Pos\Bin\CLControl.exe /SYSTEM IDLE
C:\Windows\System32\shutdown.exe /r /t 01 /d p:1:1

My Google foo just decided to work and I found that remote reboot is available.

MICROS RES RemoteReboot version 4.1
usage: RemoteReboot [/?] [-h] [/allclients] [<nodenames>]+

/? or -h prints this help message.

/allclients reboots all configured clients. Will not reboot the server.

Specifying one or more computer nodenames on the command line will cause
a message to be sent to reboot only those client workstations


So this should work:
@echo off
D:\MICROS\Common\Bin\RemoteReboot.exe /allclients
 
Pretty much every Micros vendor sets the system up with an autosequnce to do the reboot, so this is on your dealer. Every dealer or office we've ever worked with went about it either through a scheduled task or auto sequence, so their being aghast it hadn't been reboot in a month is basically a sign they didn't setup their stuff correctly.

Also, word of warning, the CLControl.exe /SYSTEM IDLE will time out on some larger databases before the shutdown actually completes, which means that your reboot might happen while its still shutting off. This tends to be a not good thing because the DB file won't be done being written to, and can cause data corruption. CLControl does have a way to check the status; you might want to throw some code in to check the status and wait until it shows IDLE.
 
Thank you Moregelen! I too feel the dealer failed. Pretty ridiculous.

We will code and make sure the DB status says IDLE. Thanks for the heads up.
 
See if the dealer installed a folded called "Micros Support Files" or "Support Files" In that folder should be a "Programs_Utilities" folder. If they did install the support files you should find the Micros coded reboot script and an installer in that folder in a folder called "Autoreboot
 
Wildbar- no such luck. I have the media, I think, Res 5.4 mr1, but do not see it on there.
 
Is exit code the current status?


d:\MICROS\Res\Pos\Bin>clcontrol.exe /SYSTEM STATUS
0000000 09/05/2017 10:50:57 Tue Sep 05 10:50:57 2017
0000000 09/05/2017 10:50:57 recData->error : => : 0
0000125 09/05/2017 10:50:57 Exit Code ===> 4
 
Yeah, here is the C# code I use to manage the server.

Code:
[COLOR=#0000FF]using[/color] System;
[COLOR=#0000FF]using[/color] System.Diagnostics;
 
[COLOR=#0000FF]namespace[/color] CustomLibraries.Micros
{
    [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<summary>[/color]
    [COLOR=#808080]///[/color][COLOR=#008000] Provides basic controls aand functions for the Micros database[/color]
    [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]</summary>[/color]
    [COLOR=#0000FF]public[/color] [COLOR=#0000FF]class[/color] [COLOR=#2B91AF]ServerController[/color]
    {
        [COLOR=#0000FF]#region[/color] METHODS
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<summary>[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] Safely reboots the back office PC[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]</summary>[/color]
        [COLOR=#0000FF]public[/color] [COLOR=#0000FF]static[/color] [COLOR=#0000FF]void[/color] RebootPC()
        {
 
            [COLOR=#2B91AF]ServerController[/color].WaitForStatus([COLOR=#2B91AF]MicrosStatus[/color].IDLE, [COLOR=#0000FF]int[/color].MaxValue); [COLOR=#008000]//ServerController.SetMicrosState(MicrosStatus.IDLE);[/color]
            [COLOR=#0000FF]if[/color] ([COLOR=#2B91AF]ServerController[/color].GetMicrosState() != [COLOR=#2B91AF]MicrosStatus[/color].IDLE)
                [COLOR=#0000FF]return[/color];
            [COLOR=#2B91AF]Process[/color].Start([COLOR=#A31515]"shutdown.exe"[/color], [COLOR=#A31515]"-r -t 0 -f"[/color]);
        }
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<summary>[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] Returns the current state of the Micros database[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]</summary>[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<returns>[/color][COLOR=#008000]Micros database's current state[/color][COLOR=#808080]</returns>[/color]
        [COLOR=#0000FF]public[/color] [COLOR=#0000FF]static[/color] [COLOR=#2B91AF]MicrosStatus[/color] GetMicrosState()
        {
            [COLOR=#0000FF]try[/color]
            {
                [COLOR=#2B91AF]Process[/color] p = [COLOR=#0000FF]new[/color] [COLOR=#2B91AF]Process[/color]();
                p.StartInfo.FileName = [COLOR=#A31515]"clcontrol"[/color];
                p.StartInfo.Arguments = [COLOR=#A31515]"/system status"[/color];
                p.StartInfo.CreateNoWindow = [COLOR=#0000FF]true[/color];
                p.StartInfo.UseShellExecute = [COLOR=#0000FF]false[/color];
                p.StartInfo.RedirectStandardError = [COLOR=#0000FF]true[/color];
                p.StartInfo.RedirectStandardOutput = [COLOR=#0000FF]true[/color];
                p.Start();
                p.WaitForExit();
                [COLOR=#0000FF]int[/color] statusCode = p.ExitCode;
                [COLOR=#0000FF]if[/color] (statusCode < 0 || statusCode > 5)
                    [COLOR=#0000FF]return[/color] [COLOR=#2B91AF]MicrosStatus[/color].UNKNOWN;
                [COLOR=#0000FF]return[/color] ([COLOR=#2B91AF]MicrosStatus[/color])statusCode;
            }
            [COLOR=#0000FF]catch[/color] ([COLOR=#2B91AF]Exception[/color] ex)
            {
                [COLOR=#2B91AF]Log[/color].DebugException([COLOR=#0000FF]typeof[/color]([COLOR=#2B91AF]ServerController[/color]), ex);
                [COLOR=#0000FF]return[/color] [COLOR=#2B91AF]MicrosStatus[/color].UNKNOWN;
            }
        }
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<summary>[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] Attempts to set the micros database to the specified state[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]</summary>[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<param name="[/color]state[COLOR=#808080]"></param>[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<returns>[/color][COLOR=#008000]Micros database's status after attempt[/color][COLOR=#808080]</returns>[/color]
        [COLOR=#0000FF]public[/color] [COLOR=#0000FF]static[/color] [COLOR=#2B91AF]MicrosStatus[/color] SetMicrosState([COLOR=#2B91AF]MicrosStatus[/color] state)
        {
            [COLOR=#0000FF]if[/color] ([COLOR=#2B91AF]ServerController[/color].GetMicrosState() == state)
                [COLOR=#0000FF]return[/color] state;
 
            [COLOR=#2B91AF]Process[/color] p = [COLOR=#0000FF]new[/color] [COLOR=#2B91AF]Process[/color]();
            p.StartInfo.FileName = [COLOR=#A31515]"clcontrol"[/color];
            p.StartInfo.CreateNoWindow = [COLOR=#0000FF]true[/color];
            p.StartInfo.UseShellExecute = [COLOR=#0000FF]false[/color];
            p.StartInfo.RedirectStandardError = [COLOR=#0000FF]true[/color];
            p.StartInfo.RedirectStandardOutput = [COLOR=#0000FF]true[/color];
 
            [COLOR=#0000FF]switch[/color] (state)
            {
                [COLOR=#0000FF]case[/color] [COLOR=#2B91AF]MicrosStatus[/color].BOH:
                    p.StartInfo.Arguments = [COLOR=#A31515]"/system boh"[/color];
                    [COLOR=#0000FF]break[/color];
                [COLOR=#0000FF]case[/color] [COLOR=#2B91AF]MicrosStatus[/color].DB:
                    p.StartInfo.Arguments = [COLOR=#A31515]"/system db"[/color];
                    [COLOR=#0000FF]break[/color];
                [COLOR=#0000FF]case[/color] [COLOR=#2B91AF]MicrosStatus[/color].FOH:
                    p.StartInfo.Arguments = [COLOR=#A31515]"/system foh"[/color];
                    [COLOR=#0000FF]break[/color];
                [COLOR=#0000FF]case[/color] [COLOR=#2B91AF]MicrosStatus[/color].IDLE:
                    p.StartInfo.Arguments = [COLOR=#A31515]"/system idle"[/color];
                    [COLOR=#0000FF]break[/color];
                [COLOR=#0000FF]default[/color]:
                    [COLOR=#0000FF]return[/color] [COLOR=#2B91AF]ServerController[/color].GetMicrosState();
            }
 
            p.Start();
            p.WaitForExit();
            [COLOR=#0000FF]return[/color] [COLOR=#2B91AF]ServerController[/color].GetMicrosState();
        }
        [COLOR=#0000FF]public[/color] [COLOR=#0000FF]static[/color] [COLOR=#0000FF]void[/color] WaitForStatus([COLOR=#2B91AF]MicrosStatus[/color] state, [COLOR=#0000FF]int[/color] timeout)
        {
            [COLOR=#2B91AF]DateTime[/color] startTime = [COLOR=#2B91AF]DateTime[/color].Now;
            [COLOR=#0000FF]do[/color]
            {
                SetMicrosState(state);
                [COLOR=#0000FF]if[/color] (GetMicrosState() != state)
                    [COLOR=#0000FF]if[/color] (([COLOR=#2B91AF]DateTime[/color].Now - startTime).TotalSeconds > timeout)
                        [COLOR=#0000FF]throw[/color] [COLOR=#0000FF]new[/color] [COLOR=#2B91AF]TimeoutException[/color]();
            } [COLOR=#0000FF]while[/color] (GetMicrosState() != state);
            [COLOR=#0000FF]if[/color] (GetMicrosState() != state)
                [COLOR=#0000FF]throw[/color] [COLOR=#0000FF]new[/color] [COLOR=#2B91AF]Exception[/color]([COLOR=#A31515]"Could not set Micros database state"[/color]);
        }
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<summary>[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] Backs up the Micros database[/color]
        [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]</summary>[/color]
        [COLOR=#0000FF]public[/color] [COLOR=#0000FF]static[/color] [COLOR=#0000FF]void[/color] DoBackup()
        {
            [COLOR=#2B91AF]Process[/color] p = [COLOR=#0000FF]new[/color] [COLOR=#2B91AF]Process[/color]();
            p.StartInfo.FileName = [COLOR=#A31515]"dm.exe"[/color];
            p.StartInfo.Arguments = [COLOR=#A31515]"-B"[/color];
            p.StartInfo.UseShellExecute = [COLOR=#0000FF]false[/color];
            p.StartInfo.WindowStyle = [COLOR=#2B91AF]ProcessWindowStyle[/color].Hidden;
            p.StartInfo.CreateNoWindow = [COLOR=#0000FF]true[/color];
            p.Start();
            p.WaitForExit();
        }
        [COLOR=#0000FF]#endregion[/color]
    }
    [COLOR=#0000FF]#region[/color] ENUMS
    [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]<summary>[/color]
    [COLOR=#808080]///[/color][COLOR=#008000] Enum containing the various possible Micros database states[/color]
    [COLOR=#808080]///[/color][COLOR=#008000] [/color][COLOR=#808080]</summary>[/color]
    [COLOR=#0000FF]public[/color] [COLOR=#0000FF]enum[/color] [COLOR=#2B91AF]MicrosStatus[/color]
    {
        FAULT = 0,
        IDLE = 1,
        DB = 2,
        BOH = 3,
        FOH = 4,
        BUSY = 5,
        UNKNOWN = 6
    }
    [COLOR=#0000FF]#endregion[/color]
}
 
I Use a Batch with Logging like this.

@echo off

title EOD Shutdown Util v1.3

:: Start log ::

echo. >>D:\out\eod_reboot.log
echo %date% %time% >>c:\out\eod_reboot.log

:: Get Day of Week ::

:: Manual override for immediate execution ::

echo.
if '%1'=='' goto start
if not '%1'=='Now' echo Valid Parameter Not Used!! && echo Valid Parameter Not Used!! >>D:\out\eod_reboot.log && goto endlog
if %1==Now set goreboot=execute && echo Reboot Override Used!! && echo Reboot Override Used!! >>D:\out\eod_reboot.log && goto manual

:start
set weekday=
FOR /F "tokens=1 delims= " %%i in ("%date%") do set weekday=%%i

echo.
echo Day of Week is %weekday%
echo Day of Week is %weekday% >>D:\out\eod_reboot.log
echo.

set goreboot=execute
rem if %weekday%==Wed (set goreboot=execute)
rem if %weekday%==Sun (set goreboot=execute)
if '%goreboot%'=='' echo Day not Wed or Sun...will NOT Reboot! >>D:\out\eod_reboot.log
if '%goreboot%'=='' echo Day not Wed or Sun...will NOT Reboot! && goto endlog
:manual
if %goreboot%==execute echo EOD Reboot WILL be executed >>D:\out\eod_reboot.log
if %goreboot%==execute echo EOD Reboot WILL be executed


:: Find POS's ::

echo.
echo Searching for total number of POS's...Please Wait
echo Searching for total number of POS's... >>D:\out\eod_reboot.log
echo.
goto findpos

:foundpos
cls
echo.
echo Found POS's %poscount%
echo Found POS's %poscount% >>D:\out\eod_reboot.log
echo.

:: Stop the database ::

echo.
echo Setting the DB level to OFF...
echo Setting the DB level to OFF... >>D:\out\eod_reboot.log
echo.

clcontrol /s idle >>D:\out\eod_reboot.log
if not %errorlevel% EQU 9999 (echo Set DB Mode Failed!!) ELSE echo Set DB OFF Successful!

echo.
echo Sleeping for 15 seconds
echo.
sleep 15


rem :: Reboot PCWS first (WinXP delay) ::

rem setlocal EnableDelayedExpansion
rem set sleepsec=40

rem echo.
rem echo Starting Reboot DT02... >>D:\out\eod_reboot.log
rem echo Starting Reboot DT02...
rem echo.
rem remotereboot dt02 >>D:\out\eod_reboot.log
rem if %errorlevel% EQU 0 (echo DT02 Reboot Successful!!) ELSE echo DT02 Reboot Failed!
rem echo.
rem echo Sleeping %sleepsec% seconds while DT02 shuts down... >>D:\out\eod_reboot.log
rem echo Sleeping %sleepsec% seconds while DT02 shuts down...
rem sleep %sleepsec%
rem echo.
rem echo End DT02 reboot sequence >>D:\out\eod_reboot.log && echo. && echo End DT02 reboot sequence
rem endlocal

:: Reboot all other POS workstations ::

echo.
echo Sending reboot command to all POS's...
echo Sending reboot command to all POS's... >>D:\out\eod_reboot.log
echo.

D:\MICROS\Common\Bin\remotereboot.exe /all >>D:\out\eod_reboot.log
if %errorlevel% EQU 0 (echo Remote Reboot Successful!!) ELSE echo Reboot Process Failed!

echo.
echo.
echo Sleeping for 120 seconds
echo.

sleep 120


:: Shutdown and restart the BOH server w/ delay ::
set shutsecs=10

echo.
echo.
echo Restarting the BoH Server in %shutsecs% seconds...
echo Restarting the BoH Server... >>D:\out\eod_reboot.log
echo.

shutdown.exe /r /t %shutsecs% >>D:\out\eod_reboot.log
if %errorlevel% EQU 0 (echo BoH Shutdown Successful!!) ELSE echo Shutdown Process Failed!

echo. >>D:\out\eod_reboot.log
:endlog
echo Batch completed at %date% %time% >>D:\out\eod_reboot.log
echo ********************************************************** >>D:\out\eod_reboot.log


goto :EOF

:findpos

:: looping through pos's ::


ping -n 1 192.168.0.1
if %errorlevel% EQU 0 set pos1=WS01

:: ADD MORE POS HERE ::


set poscount=%pos1% %pos2% %pos3% %pos4% %pos5% %pos6% %pos7% %pos8% %pos9% %pos10% %pos11% %pos12% %pos13% %pos14% %pos15% %pos16% %pos17% %pos18% %pos19% %pos20% %pos21% %pos22% %pos23%
%pos24% %pos25% %pos26% %pos27%

goto foundpos

:EOF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top