Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Lorsque vous définissez un workflow de sauvegarde et de reprise après sinistre LiveClone qui effectue un prénettoyage, vous pouvez choisir entre le masquage des données de confidentialité Optim ou des scripts personnalisés.
Pour les scripts personnalisés, spécifiez au moins un script de pré- ou post-traitement.
Spécifiez un pré-script si nécessaire. Le pré-script permet de configurer l'environnement avant de monter ou de démonter l'application. Ce script doit se trouver dans un dossier nommé /act/scripts sur le serveur qui héberge l'image montée.
Dans le champ Timeout in Seconds (Délai avant expiration en secondes) correspondant, spécifiez le temps nécessaire pour que le script soit exécuté.
Spécifiez un post-script si nécessaire. Post-script utilisé pour effectuer une opération sur les données après leur montage ou leur démontage. Ce script doit se trouver dans un dossier nommé /act/scripts sur le serveur qui héberge l'image montée.
Dans le champ Timeout in Seconds (Délai avant expiration en secondes) correspondant, spécifiez le temps nécessaire pour que le script soit exécuté.
Scripts de pré et post-workflow de sauvegarde et de reprise après sinistre
Les workflows Backup and DR montent et démontent les images de sauvegarde selon un calendrier ou à la demande. Dans un workflow de sauvegarde et de reprise après sinistre, vous pouvez appeler les éléments suivants:
Un pré-script qui s'exécute avant qu'une image ne soit montée ou démontée
Post-script exécuté après le montage ou le démontage d'une image
La possibilité d'exécuter un script avant et après le montage ou le démontage des données vous permet de procéder comme suit:
Nettoyer les informations sensibles
Générer des rapports
Données d'entrepôt, en particulier pour les opérations d'extraction, de transformation et de chargement (ETL)
Les scripts doivent se trouver dans un dossier nommé /act/scripts sur le serveur qui héberge l'image du workflow de sauvegarde et de reprise après sinistre montée.
Variables d'environnement
Les variables d'environnement vous permettent d'appeler des commandes qui s'appliquent à des tâches, types de tâches ou applications spécifiques. Les variables d'environnement sont précédées du préfixe ACT_. Par exemple, une variable d'environnement pour une base de données peut se présenter comme suit:
[$ACT_APPNAME =="productiondb"]
Une variable d'environnement pour une opération de montage peut ressembler à ceci:
[$ACT_JOBTYPE == "mount"]
Voici une liste de variables d'environnement courantes avec des exemples de valeurs:
JOBNAME: nom de la tâche (par exemple, Job_0123456).
APPID: ID de l'application (par exemple, 4186).
APPNAME: nom de l'application (par exemple, My-DB).
HOSTNAME: nom de l'hôte qui est la cible de cette tâche (par exemple, Jupiter).
SOURCEHOST: nom de l'hôte qui a été la source de cette application (par exemple, Saturn).
JOBTYPE: version textuelle de la classe de tâche (par exemple, "mount" ou "unmount").
PHASE: chaîne de texte décrivant la phase de la tâche (par exemple, pré ou post).
TIMEOUT: définit la durée du script, c'est-à-dire la durée pendant laquelle le script est autorisé à s'exécuter.
OPTIONS: options de stratégie qui s'appliquent à cette tâche.
Exemple de script
L'exemple de script suivant utilise trois variables d'environnement:
ACT_JOBTYPE: indique si la tâche est une opération d'installation ou de désinstallation.
ACT_PHASE: indique si la phase est pré- ou post-.
ACT_MULTI_END: n'est utilisé que si une base de données et son journal sont montés. Dans ce cas, la base de données est accessible.
```sh#!/bin/shset+xecho"*** Running user script: Job - $ACT_JOBNAME Type - $ACT_JOBTYPE Phase - $ACT_PHASE***"#Usethefirstifclausetoperformapplicationspecificoperationsduringmountandinthisexamplescrub-mountoperation.#Usethesecondifclausetoperformanyapplicationspecificoperationduringunmountandinthisexample,#scrub-unmountoperation.#if [[ $ACT_JOBTYPE == "mount" ]] || [[ $ACT_JOBTYPE == "scrub-mount" ]]; thenif[[$ACT_JOBTYPE=="unmount"]]||[[$ACT_JOBTYPE=="scrub-unmount"]];thenecho"NO-OP for job type $ACT_JOBTYPE"exit0fi#Usethefirstifclausetoperformapplicationspecificoperationsduringtheprephase.#Usethesecondifclausetoperformapplicationspecificoperationsduringthepostphase.#if [[ $ACT_PHASE == "post" ]]; thenif[[$ACT_PHASE=="pre"]];thenecho"NO-OP for phase $ACT_PHASE"exit0fi#Formulti-phasejobs(databaseandlogs)checkifthedatabasehasbeenmountedandthelogsappliedthen#skiplogs.#Iftheoperationneedstobeperformedinphasesotherthanthelastphase,modifytheclause.if[[-z"$ACT_MULTI_END"]] && [[$ACT_MULTI_END!="true"]];thenecho"NO-OP for multi-phase operation"exit0ficd/act/scriptsecho"**** Running application specific logic: Job - $ACT_JOBNAME Type - $ACT_JOBTYPE Phase - $ACT_PHASE *"Anyapplicationspecificcommandswillgohereecho"** Finished running application specific logic : Job - $ACT_JOBNAME Type - $ACT_JOBTYPE Phase - $ACT_PHASE*"exit$?```
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eLiveClone Backup and DR Workflows can utilize pre- and post-processing scripts to run operations before or after mounting/unmounting backup images, such as data scrubbing, generating reports, or warehousing data.\u003c/p\u003e\n"],["\u003cp\u003ePre- and post-scripts must be stored in the \u003ccode\u003e/act/scripts\u003c/code\u003e directory on the server hosting the mounted image, and a timeout duration must be specified for each script to complete its execution.\u003c/p\u003e\n"],["\u003cp\u003eEnvironment variables prefixed with \u003ccode\u003eACT_\u003c/code\u003e, such as \u003ccode\u003eACT_JOBTYPE\u003c/code\u003e, \u003ccode\u003eACT_PHASE\u003c/code\u003e, and \u003ccode\u003eACT_APPNAME\u003c/code\u003e, can be used within scripts to tailor operations to specific jobs, phases, or applications.\u003c/p\u003e\n"],["\u003cp\u003eFor workflows involving both a database and its logs, the pre- and post-script operations should be configured to avoid being applied to the database's logs, which can be achieved using the \u003ccode\u003eACT_MULTI_END\u003c/code\u003e variable in the script.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTIMEOUT\u003c/code\u003e variable is used to define the duration of the script, in other words, the amount of time the script is allowed to run.\u003c/p\u003e\n"]]],[],null,["# Custom scripts\n\nWhen defining a LiveClone Backup and DR Workflow that performs pre-scrubbing you can\nselect from Optim privacy data masking or custom scripts.\n\nFor custom scripts, specify at least one pre- or post-processing script.\n\n- Specify a pre-script as needed. The pre-script is used to configure the environment prior to mounting or unmounting the application. This script must reside in a folder named `/act/scripts` on the server that hosts the mounted image.\n- In the corresponding **Timeout in Seconds**, specify the time that is needed for the script to complete.\n- Specify a post-script as needed. The post-script used to perform an operation on the data after it is mounted or unmounted. This script must reside in a folder named `/act/scripts` on the server that hosts the mounted image.\n- In the corresponding **Timeout in Seconds**, specify the time that is needed for the script to complete.\n\nBackup and DR Workflow Pre and Post Scripts\n-------------------------------------------\n\nBackup and DR Workflows mount and unmount backup images according to a schedule\nor on-demand. In a Backup and DR Workflow you can call the following:\n\n- A pre-script that runs before an image is mounted or unmounted\n- A post-script that runs after an image is mounted or unmounted\n\nThe ability to run a script before and after data is mounted or\nunmounted lets you do the following:\n\n- Scrub for sensitive information\n- Generate reports\n- Warehouse data, especially for extract, transform, and load---ETL--- operations\n\nScripts must reside in a folder named `/act/scripts` on the server\nthat hosts the mounted Backup and DR Workflow image.\n| **Note:** For Backup and DR Workflows that involve both a database and its logs, you must configure scripts in such as way that pre- and post-script operations are not applied to the database's logs. See *Example Script* for a script example that contains a command that skips a database's log.\n\n### Environment variables\n\nEnvironment variables allow you to invoke commands that apply to specific jobs,\njob types, or applications. Environment variables are prefixed with `ACT_`. For\nexample, an environment variable for a database could look like: \n\n [$ACT_APPNAME ==\"productiondb\"]\n\nor an environment variable for a mount operation could look like: \n\n [$ACT_JOBTYPE == \"mount\"]\n\nThe following is a list of common environment variables with sample values:\n\n- **JOBNAME**: The name of the job---for example, Job_0123456.\n- **APPID**: The ID of the application---for example, 4186.\n- **APPNAME**: Name of the application---for example, My-DB.\n- **HOSTNAME**: The name of the host which is the target of this job---for example, Jupiter.\n- **SOURCEHOST**: The name of the host that was the source for this application---for example, Saturn.\n- **JOBTYPE**: A text version of the job class---for example, mount or unmount.\n- **PHASE**: A text string that describes the job phase---for example, pre or post.\n- **TIMEOUT**: Define the duration of the script, how long the script is allowed to run.\n- **OPTIONS**: Policy options that apply to this job.\n\n### Example script\n\nThe following script example uses three environment variables:\n\n- **ACT_JOBTYPE**: Identifies whether the job is a mount or unmount operation.\n- **ACT_PHASE**: Identifies whether the phase is either pre or post.\n- **ACT_MULTI_END**: Used only if both a database and its\n log are mounted. When this is true, the database is in a state where it\n can be accessed.\n\n **Note:** The following example script is not meant to be used in a production environment, has not been tested, and is not warranted by Backup and DR Service. \n\n ```sh\n #!/bin/sh\n set +x\n echo \"*** Running user script: Job - $ACT_JOBNAME Type - $ACT_JOBTYPE Phase - $ACT_PHASE***\"\n\n #Use the first if clause to perform application specific operations during mount and in this example scrub-mount operation.\n\n #Use the second if clause to perform any application specific operation during unmount and in this example, #scrub-unmount operation.\n\n #if [[ $ACT_JOBTYPE == \"mount\" ]] || [[ $ACT_JOBTYPE == \"scrub-mount\" ]]; then\n if [[ $ACT_JOBTYPE == \"unmount\" ]] || [[ $ACT_JOBTYPE == \"scrub-unmount\" ]]; then\n echo \"NO-OP for job type $ACT_JOBTYPE\"\n exit 0\n fi\n\n #Use the first if clause to perform application specific operations during the pre phase.\n\n #Use the second if clause to perform application specific operations during the post phase.\n\n #if [[ $ACT_PHASE == \"post\" ]]; then\n if [[ $ACT_PHASE == \"pre\" ]]; then\n echo \"NO-OP for phase $ACT_PHASE\"\n exit 0\n fi\n\n #For multi-phase jobs (database and logs) check if the database has been mounted and the logs applied then #skip logs.\n\n #If the operation needs to be performed in phases other than the last phase, modify the clause.\n\n if [[ -z \"$ACT_MULTI_END\" ]] && [[ $ACT_MULTI_END != \"true\" ]]; then\n echo \"NO-OP for multi-phase operation\"\n exit 0\n fi\n\n cd /act/scripts\n\n echo \"**** Running application specific logic: Job - $ACT_JOBNAME Type - $ACT_JOBTYPE Phase - $ACT_PHASE *\"\n\n Any application specific commands will go here\n\n echo \"** Finished running application specific logic : Job - $ACT_JOBNAME Type - $ACT_JOBTYPE Phase - $ACT_PHASE*\"\n exit $?\n ```"]]