An example of the batch file is attached below.
- For u9 and lower, these instructions require someone who understands batch files and standard Microsoft Windows features such as the Windows Scheduled Task. If you need assistance, reach out to your certified Sage consultant, Professional Services, or IT department. This should be tested on a test environment prior to implementing on a live system. The steps below (for u9 and lower) were tested on u9, and may or may not work for other versions.
- In v11, the batch server becomes part of Syracuse. This means when the Syracuse service is stopped, the node for the batch server is also stopped and thus no auto-stop is required. The accounting task should still be stopped prior to shutting down the application server though. The steps below (for v11 section) was tested on v11, and may or may not work for v12 and higher.
- In v12p15 and higher, the accounting task becomes a recurring task, so at the time of this article was last modified, does not apply to v12 in its entirety.
For version 11:
- Go into Administration > Endpoints > Batch Server.
- Click the pencil icon to edit.
- Checkmark “Auto start”.
- If you have multiple child folders, go into Usage, Batch Server, Task Management (GESABT). If not, skip to the next step.
- Pull up ACCBATCH and ACCBATCH1 and checkmark “Multi-folder”.
- Go into Usage, Batch Server, Recurring Tasks (GESABA).
- Create a recurring task, using the Task code of ACCBATCH, and use fixed hours like the screenshot below, with all days of the workweek (or weekend) selected, depending on when you are scheduling your system for a reboot.
- Checkmark “Forced execution”.
- You can go as far as creating multiple recurring tasks like this to turn on the accounting tasks throughout the day.
When the server reboots, Syracuse services should start, launching the batch server, and the batch server should therefor run this recurring task to launch ACCBATCH, which then launches ACCBATCH1 (the accounting tasks).
For update 9 and lower versions:
See the related documentation for recurring task management (on how to):
- Stop the Journal Status Monitor = Accounting tasks (VALPCE). There is a predefined task ACCSTOP
- Stop the Batch server. There is a predefined task BATCHSTOP (Product Update 9 and below)
- Start the Journal Status Monitor = Accounting tasks. There is a predefined task ACCBATCH
Notes: The Sage X3 Batch server manages tasks and recurring tasks, therefore:
- There is not a recurring task which can start be Batch server (BATCHRUN) if the Batch server is not already running. This is because the Batch server needs to be running in order to process the recurring task in the first place.
- The .bat file you will create below (Windows batch file such as autoexec.bat) will be used to start the Batch server.
- The .bat file will execute a .job file, which starts the Accounting task.
- IMPORTANT: When stopping the Batch server, it is important to stop the Accounting tasks first. Consider stopping any existing recurring tasks prior to stopping the Batch server. If there are other tasks queued up and processing when the Batch server (ACCBATCH task) is started, it will delay the start of the Accounting tasks (ACCBATCH1 task). You can see this in the Query management (AREQUETE) log.
- You can use a recurring task as noted above to stop the Accounting tasks and Batch server
OVERVIEW OF PROCESS:
To start the Batch server automatically, we can create a batch (.bat) file. This batch file can be used in many ways, including allowing it to be executed by a Windows Scheduled Task, which can be added to the Windows startup menu to start the Batch server and thus the Accounting tasks after a server reboots, or can be added as a script to be run after a backup is completed in the middle of the night. Although you can use a recurring task to start the Accounting tasks function, the steps below demonstrate a method to start both the Batch server and the Accounting tasks at the same time.
We are creating a folder that will store our .bat file, used to start the Batch server, which in turn executes a .job file to start the Accounting tasks. The .bat file will need to be run as a Windows Scheduled Task as part of the Windows operating system, or another method outside of Sage X3 . The .bat file will:
- Copy the .job file into a specified location to be monitored by the Batch server
- Start the Batch server
- Once the Batch server processes this .job file, this action will start the Accounting tasks.
- The .job file in the specified location will be deleted leaving only your original file in the location with the .bat file.
In Sage X3 , authorize the submission of requests to the Batch server from an external source
- Go to Setup>GENERAL PARAMETERS>Parameter Values (ADPVAL)
- Select the Chapter SUP
- Click on the Actions card next to AUZ and select Detail
- Change the EXTBATCH value to Yes
- Click OK
- Click Save
- Click Close page
Define a specified location that will be monitored by the Batch server
- Using Windows file explorer, browse to your folders TMP folder and create a subfolder for Batch server use, for example, C:\Sage\
- In Sage X3 , go to Setup>USAGE>Batch server>Batch server parameters (ABATPAR)
- Mark the check box Use of batch files
- Enter or select the full path to the subfolder that you created in Directory of query start files (.job) and Directory of template files (.mod)
- Click OK
- Log out of Sage X3
Create a template (.mod) for starting the Accounting tasks function
- In Sage X3, go to Usage>BATCH SERVER>Query submission (EXERQT)
- Select the Folder, User code, and type the Password
- Select ACCBATCH for the Task code
- Mark the Template checkbox
- Note: The Template checkbox may not be available until prior steps listed above are completed.
- Click Validation
- Click Ok
Create and manage the files in Windows
Note: If you modify the .mod or .job file manually, make sure there is a carriage return after the first line, or else the .sta file will show an error stating "BATCH FILE STRUCTURE INCORRECT"
- Create a folder location to store the final .bat and .job file.
- Copy the ACCBATCH.mod template file from the defined Directory of template files (.mod) to your final location.
- Rename the ACCBATCH.mod to ACCBATCH.job in your final location.
- Using a text editor, open the ACCBATCH.job and change the value of HEURE to a military time prior when your Windows scheduled task will run, for example HEURE=0005
Note: If you use a time that is later than the time of the Windows scheduled task, the Accounting tasks will not start until the specified time.
- Locate the env.bat file inside the ...Runtime\bin\ folder.
- Using a text editor, copy the contents of env.bat file into a new text file.
- Append a line to copy the ACCBATCH.job from your final location back to the Directory of query start files (.job)
- For example, copy c:\
\accbatch.job C:\Sage\ \folders\SEED\TMP\BatchServer
- For example, copy c:\
- Append a line to start the Batch server itself.
- Syntax is: Start "" "C:\Sage\
\runtime\bin\adonix" -a -s -l ENG SERVX3
is the port number for the application server. In the env.bat file, it will be on the AE_SERVICE = xxxx line. The value may be 1809, 1807, 1806 or some other variation close to that. You must use the correct port value. Do not guess. Verify what the env.bat file shows and use that value.
- Example: start "" "C:\Sage\X3V6\Runtime\Bin\adonix" -a -s 1807 -l ENG SEED
- Syntax is: Start "" "C:\Sage\
- Save the .bat file to your final location (same location that *.job file will be copied to) and close.
You can now run this batch file (i.e. manually click it, use the Windows Scheduled Task, or place in the Windows Start Menu for when the server starts back up) to automatically start the Batch server and Accounting tasks. Contact your IT department to set up the Windows Scheduled Task or the Windows Start Menu.DocLink: HTG - Recurring Task Management