Technical
Tips
How to Automatically Back Up the Information on the HULFT Script Server
Introduction
Many HULFT Script users want to periodically back up the information on the server to be prepared for any failures that might occur.
Now, let's talk about using a CLI batch in HULFT Script to automatically back up and restore server information.
About CLI Console
HULFT Script provides a CLI (command line interface) for managing the HULFT Script Server.
The CLI provides the following functions:
Function | Description |
---|---|
Manage Users | Performs tasks such as creating new users, assigning user permissions, and displaying user information. |
Manage Groups | Performs tasks such as creating groups, deleting groups, and viewing group information. |
Manage Files and Directories | Performs tasks such as creating, moving, or copying files or directories and changing owners or groups. |
Manage Projects | Performs tasks such as downloading or uploading projects and displaying project information. |
Execute and Manage Services | Performs tasks such as executing scripts and displaying lists of services or scripts. |
Suppress Triggers | Suppresses triggers. |
Display System Information | Displays system information such as process information and repository database information. |
Operate and Manage HULFT System Server | Performs tasks such as stopping or restarting HULFT Script Server and performing server migration (importing and exporting information). |
By using the Operate and Manage HULFT System Server function described above,
you can create a CLI batch for importing and exporting server information, and use it to back up the server automatically.
Use the following commands to create a CLI batch:
Command | Description |
---|---|
Command | Exports server information. |
imp | Imports server information. |
Creating a Backup CLI Batch
Let's create a CLI batch using the commands in the previous section.
Note: Use a text editor such as Notepad to create the CLI command settings file and the CLI batch file.
Let's assume you create the following data in HULFT Script, and that you want to back the data up.
My Project | sample |
---|---|
My Service | sample |
Mount Settings | /c, /D |
1. Create a CLI command settings file (Backup.cl) containing the following command:
exp -d --trigger=root:sample --project=root:sample -m --triggerstatus=disable D:\backup\hulftscript.
Argument | Description |
---|---|
-d | All services |
-m | All mount points |
--project | user:target-project-name |
--trigger | user:target-trigger-name |
--triggerstatus | target-trigger-status |
D:\backup\hulftscript | Destination directory Note: You must create this directory in advance. |
2. Create a CLI batch (Backup.bat).
echo off
cls
rem get full file path of CLI configuration file
set file="%~dp0"\Backup.cl
rem processing to export
"C:\HULFT Family\HULFT8 Script\server\bin\CLI.exe" -M%file%
3. Execute the CLI batch (Backup.bat).
Note: Save the CLI settings file in the same directory as the CLI batch.
c:\sample>ls
Backup.bat Backup.cl
c:\sample>Backup.bat.
4. The file is exported successfully.
Services export was successful. [root@sample]
Triggers export was successful. [root@sample]
Project files export was successful. [/home/root/projects/sample]
Mount settings export was successful. [/c]
HULFT Script Server settings were exported as D:\backup\hulftscript\export_20150514171835.zip.
c:\sample>

Creating Backup Schedule Information
We've confirmed that the CLI batch operates correctly, so next we'll use the HULFT scheduler function to create a backup schedule.
We'll set it to back up the HULFT Script Server information every Sunday at 6:00 p.m.

- Command
Specify the full path of the CLI batch you created.
- Frequency
Every Week - Execution Day of the Week
Sunday
- Holiday Processing
Holiday Processing - Execution Time
18:00
Note: Back up the HULFT management information and the HULFT Script information at the same time, to prevent a data mismatch from occurring.
About Restoring Information
1. Start CLI Console.
Type 'help' to get list of available commands.
#
2. For the imp command, specify the file you exported.
# imp -m --triggerstatus=disable D:\backup\hulftscript\export_20150515113246.zip
Succeeded in importing service. Succeeded in importing trigger.
Import mount settings successful.
Argument | Overview |
---|---|
-m | Performs an incremental import. |
triggerstatus | Disables the trigger status. |
D:\backup\... | File to be imported. |
Extra
Here is a sample CLI batch that uses the imp command.
@echo off
:Main
set merge_flag=0
set status_flag=0
set file_path=
set cmd=
cls
echo ==============================
echo 1:merge import
echo 2:don't merge import
echo q:quit
echo ==============================
set select=
set /p select=">"
if "%select%"=="1" goto merge_flag
if "%select%"=="2" goto merge_flag
if "%select%"=="q" goto :eof
goto :Main
:merge_flag
set merge_flag=%select%
cls
echo ==============================
echo 1:enable all triggers
echo 2:disable all triggers
echo 3:status as exportting
echo q:quit
echo ==============================
set select=
set /p select=">"
if "%select%"=="1" goto status_flag
if "%select%"=="2" goto status_flag
if "%select%"=="3" goto status_flag
if "%select%"=="q" goto :eof
goto :Main
:status_flag
set status_flag=%select%
cls
set /p file_path="Please input file path.>"
if "%file_path%"=="" (
cls
echo Please input file path.
pause
goto :Main
)
rem ========================================
rem command assembly
rem ========================================
if "%merge_flag%-%status_flag%"=="1-1" (
set cmd=imp -m --triggerstatus=enable %file_path%
)
if "%merge_flag%-%status_flag%"=="1-2" (
set cmd=imp -m --triggerstatus=disable %file_path%
)
if "%merge_flag%-%status_flag%"=="1-3" (
set cmd=imp -m %file_path%
)
if "%merge_flag%-%status_flag%"=="2-1" (
set cmd=imp --triggerstatus=enable %file_path%
)
if "%merge_flag%-%status_flag%"=="2-2" (
set cmd=imp --triggerstatus=disable %file_path%
)
if "%merge_flag%-%status_flag%"=="2-3" (
set cmd=imp %file_path%
)
goto import
rem ========================================
:import
echo %cmd% >"%~dp0"\restore.cl
cls
echo ==============================
echo 1:do importting
echo 2:do not importting
echo ==============================
set select=
set /p select=">"
if "%select%"=="1" "C:\HULFT Family\HULFT8 Script\server\bin\CLI.exe" -M"%~dp0"\restore.cl
if "%select%"=="2" goto Main
pause
goto Main
Let's try using the sample batch.
1. Select whether to perform an incremental import, and press Enter.
==============================
1:merge import
2:don't merge import
q:quit
==============================
>1
2. Select the status of the trigger you imported, and press Enter.
==============================
1:enable all triggers
2:disable all triggers
3:status as exportting
q:quit
==============================
>1
3. Enter the path of the settings file to be imported, and press Enter.
Please input file path.> D:\backup\hulftscript\export_20150515113246.zip
4. Select whether to perform an import, and press Enter.
==============================
1:do importting
2:do not importing
==============================
>1
5. The result of the import is output.
Succeeded in importing service. Succeeded in importing trigger. Import mount settings successful.
Press any key to continue ....
Conclusion
So, what do you think?
By using HULFT Script commands in a batch, you can automatically back up the server information according to a schedule.
Even if you lose the server information, you can recover your operations instantaneously by restoring the backup data.
HULFT Script provides many other useful commands. Please try using them in a CLI batch to help your operations.