How to import multiple spaces with a sleep value using Confluence Command Line Interface app (CLI)

This article explains how to import multiple spaces with a sleep value using the Confluence Command Line Interface app (CLI). 

Instructions

Follow the below steps to import large spaces:

  1. Combine runFromList with the --list parameter, and restoreExport to import multiple spaces. 

    Here, we have used the system -a sleep value 5 to wait for a defined time and then start restoring the next space.zip files.

    -a runFromList --list "aaa.zip,bbb.zip" -i "-a restoreExport -f @entry@" -i "system -a sleep value 5"


    Please refer to the below example where we have restored the spaces from this  import files spacemk1.zip and spacemk2.zip.

    -a runFromList --list "spacemk1.zip,spacemk2.zip" -i "-a restoreExport -f @entry@" -i "system -a sleep --value 5"


    The Parameters used above are. 

    --list  input the filename of the exported space you want to restore.
    --value specify the time value in seconds.

    The output of the CLI action:

    Run: -a restoreExport -f spacemk1.zip
    Restore has been started with taskId a2f5af67-3a34-47cc-860f-b8709bc6f8ff. Task status can be checked at https://confluence.example.com/rest/api/latest/longtask/a2f5af67-3a34-47cc-860f-b8709bc6f8ff.
    
    Waiting for task completion: 0% complete. Importing objects. 
    
    Waiting for task completion: 5% complete. Importing objects. 
    
    Waiting for task completion: 13% complete. Importing objects. 
    
    Waiting for task completion: 23% complete. Importing objects. 
    
    Waiting for task completion: 37% complete. Importing objects. 
    
    
    Waiting for task completion: 100% complete. Applying special processing. 
    Restore completed.
    
    Run: system -a sleep --value 5
    Continue after sleeping for 5 seconds.
    
    Run: -a restoreExport -f spacemk2.zip
    Restore has been started with taskId 3d862460-0d87-4c82-81ae-b19592653863. Task status can be checked at https://confluence.example.com/rest/api/latest/longtask/3d862460-0d87-4c82-81ae-b19592653863.
    
    Waiting for task completion: 37% complete. Importing objects. 
    
    
    Waiting for task completion: 100% complete. Complete. 
    Restore completed.
    
    Run: system -a sleep --value 5
    Continue after sleeping for 5 seconds.
    
    Run completed successfully. 4 actions were successful 


  • It is recommended to test this scenario in a non-production environment or run the action with the --simulate parameter, to verify the behavior before deploying in production environment.