You can create custom backend scripts to create custom views, import/export data, or batch update/manage data in SD Elements. Here are generic steps on how to deploy such scripts:
- Create the custom script and send it to the client.
- Ask the client to backup their data before running any such scripts.
- Ask the client to put the script in appropriate location: e.g. Copy <script-name>.py (via SCP) to the OSD into '/docs/sde/live/code/sigma/<component-name>/management/commands'. Component name is usually "library" or "application".
- Then you can run it by doing:
/docs/sde/live/env/bin/python /docs/sde/live/code/sigma/manage.py <command-name> <parmeters ...> or on new boxes: sudo -u sde_admin /docs/sde/live/env/bin/python /docs/sde/live/code/sigma/manage.py <command-name> <parmeters ...>
To hook the manage scripts to cron, the customer can do something like this:
You can also hook it to cron to run on nightly basis using these instructions. This is an example. You need to modify the command name and parameters to match the situation:
1. SSH to the box using the user “sdelements” (do not sudo to root)
2. Run “crontab -e”. It might give you a choice of editor on first run, which you can just go with default (nano which is choice 2).
3. It opens the editor. All you need to do is to add the following line to the file, save and exit.
30 2 * * * /docs/sde/live/env/bin/python /docs/sde/live/code/sigma/manage.py export_alm_csv --csv=/docs/sde/live/code/sigma/media/attachments/sde_alm_connections.csv
Make sure that it is all on one line (keep an eye on your email client trying to wrap the long line. This is a single line and needs to be on single line).
This will cause a report to be generated and updated hourly. The report is available using the following link:
If you don’t want to wait one hour for the initial report to be generate, you can just run:
/docs/sde/live/env/bin/python /docs/sde/live/code/sigma/manage.py export_alm_csv --csv=/docs/sde/live/code/sigma/media/attachments/sde_alm_connections.csv
Examples of Custom Manage Commands
Exporting Organization's Tasks to CSV: /docs/sde/live/code/sigma/library/management/commands/export-org-tasks.py
Disabling Organization's Low Priority Tasks: /docs/sde/live/code/sigma/library/management/commands/disable_low_priority_tasks.py
Exporting Organization's Customized Survey to Multiple CSV Files: /docs/sde/live/code/sigma/properties/management/commands/export-org-survey.py
Exporting Tasks and Scanning Tool Coverage to CSV:
Exporting Content to CSV: