How to create Java script to unload and load a specific .unl in HP service manager

Can anyone provide or help how to create a java script that can load and unload a specific unl file in HPSM.

Parents
  • What's the goal?  You can schedule a load/unload using the normal database unload manager.  Why do you need this added to a Javascript?  What's the goal of the improvement?

  • Hi Jacob,

    I want to perform this because My requirement is to automatically load and unload .unl file without using hpsm gui.

    I want to execute load and unload using command line sm.exe.

    The purpose of this is to automate the full deployment process of HP service manager backup and roll back as well.

  • Right - I sort of got that part.  I figured you were asking because you wanted to load records.  My question is _why_?  If you're creating an integration between two HPSM systems, there's much easier, more robust, more established ways of doing it than writing something custom to load unload files.  I'm trying to imagine the scenario where you'd have someone using the unload manager to perform actions.  

    The Text Import wizard - sure, I could see how you'd want to potentially give users access to that, or run that on some kind of schedule.  But even then, there's better ways of performing an integration to load records.

    So the question isn't _what_ are you doing?  (loading records)  The question is, what is the scenario where this makes sense to do?  Why are you doing it?  Getting an understanding about that will allow us all to be more helpful than building something custom to load unload files using Javascript instead of the GUI.

  • Right - I sort of got that part.  I figured you were asking because you wanted to load records.  My question is _why_?  If you're creating an integration between two HPSM systems, there's much easier, more robust, more established ways of doing it than writing something custom to load unload files.  I'm trying to imagine the scenario where you'd have someone using the unload manager to perform actions.  

    The Text Import wizard - sure, I could see how you'd want to potentially give users access to that, or run that on some kind of schedule.  But even then, there's better ways of performing an integration to load records.

    So the question isn't _what_ are you doing?  (loading records)  The question is, what is the scenario where this makes sense to do?  Why are you doing it?  Getting an understanding about that will allow us all to be more helpful than building something custom to load unload files using Javascript instead of the GUI.

  • Right - I sort of got that part.  I figured you were asking because you wanted to load records.  My question is _why_?  If you're creating an integration between two HPSM systems, there's much easier, more robust, more established ways of doing it than writing something custom to load unload files.  I'm trying to imagine the scenario where you'd have someone using the unload manager to perform actions.  

    The Text Import wizard - sure, I could see how you'd want to potentially give users access to that, or run that on some kind of schedule.  But even then, there's better ways of performing an integration to load records.

    So the question isn't _what_ are you doing?  (loading records)  The question is, what is the scenario where this makes sense to do?  Why are you doing it?  Getting an understanding about that will allow us all to be more helpful than building something custom to load unload files using Javascript instead of the GUI.

  • Actually this automation is performed using a automation tool.

    this automation tool need plugin to execute certain task on specified server or machine.

    So i need to create plugin which can perform load , unload and purge data of specific .unl file.

    As this automation  tool will communicate with HPSM via agent (automation tool agent which will be installed on HPSM server side)  and execute load ,unload, and purge.

    Basically this task is to migrate one environment of HPSM to other using automation tool. on which daily or weekly deployment done on regular basis.

    Please guide what are the possible ways to execute this.

  • Sorry, still trying to wrap my head around the ask.

    Tell me if I'm on the right track here -
    So, you've got a development environment of HPSM where you're doing your coding and your development work; the normal stuff that gets asked for within an organization like 'make a field for this' or 'build a wizard for this' or 'when the IM ticket closes, make sure X, Y, and Z runs'.  You build code there and dump that code (on a semi-regular basis) to an unload file.  

    Then, some other automated deployment system is supposed to take that code and deploy it in your production environment, applying the changes you've made in your code to the live environment without manual intervention.

    Is that the general idea?

  • Whoa! What happened to ITIL? Change Management, Change Management Board, Approval, Risk Assessment, user notification/training and etc etc. How do you implement a rollback if the unload changes has an issue?

    I really hope this is not for a production environment and only between dev and test environments.

    It's like looking at some folks using matches for the 1st time.

  • Jacob true you got the idea.

    see it is like HPSM development team will provide an  package which contain two file

    1.  prepare.unl and

    2. release.unl 

    that is to be loaded in pre-production environment.

    now below are deployment steps :-

    A. Load prepare.unl and then in unload script utility serach for prepare.unl ,unload it and give external path name as  prepare_backup.unl (this unloaded backup file will be used if rollback is required)

    B.  Then load the release.unl 

    C. If Rollback is required then in "unload script utility" search and unload/purge rollback.unl and gain load prepare_backup.unl that is created in step (A).

    So  step A, B and C is to be automated using automation tool. But the automation tool can controll HPSM only through HPSM OS command line or scripts (java script or RAD function script built on HPSM client side )that can be called using command line.

  • HI akkigpt,

    to unload a file, you can follow the steps I mentioned in /t5/Service-Manager-Service-Center/how-to-unload-script-in-HPSM-using-command-prompt-or-program/td-p/6898230

     sm.exe script.execute NULL NULL test.script NULL -bg

    To load a file, it's much simpler, you can run following command to load file

     

    sm.exe file.load "C:\\PROGRA~1\\HP\\SERVIC~1.0\\HPSERV~1\\unload\\test.unl" NULL NULL winnt –bg

    So to your use case, you need to:

     

    1. load prepare.unl

    sm.exe file.load "C:\\prepare.unl" NULL NULL winnt –bg

    2. create a script which defines the files you'd like to unload and directories with name prepare_backup.script, and unload to prepare_backup.unl

     sm.exe script.execute NULL NULL prepare_backup.script NULL -bg

    3. load release.unl

    sm.exe file.load "C:\\release.unl" NULL NULL winnt –bg

    4. for rollback

    sm.exe file.load "C:\\prepare_backup.unl" NULL NULL winnt –bg

    Hope it helps,

    Ling-Yan

     

     

  • Thanks

    sm.exe script.execute NULL NULL prepare_backup.script NULL -bg

     I want to purge data for rollback purpose , if a specific unl file required to rollback then data of unl has to be purged.

Reply
  • Thanks

    sm.exe script.execute NULL NULL prepare_backup.script NULL -bg

     I want to purge data for rollback purpose , if a specific unl file required to rollback then data of unl has to be purged.

Children
No Data