/docs/management-scripts.txt
Plain Text | 34 lines | 27 code | 7 blank | 0 comment | 0 complexity | cd9474a76cfc4e4bb9969f61d6e86023 MD5 | raw file
Possible License(s): GPL-2.0
- Management Scripts
- ==================
- Let's say you want to write a script to do an import or some other
- management task. This is nice and easy to do locally during
- development, but then if you want to use that command in production
- this is harder. A typical example is a script to import raw data.
- Silver Lining has support for running commands on applications, as
- though they were local applications. It looks like this::
- $ cd myapp-app
- $ silver run LOCATION import-script --setting=value ~/import-data.zip
- ``silver run`` takes as an argument the name of the script to run;
- this should be a script that has been uploaded to the server (either a
- path relative to your app root, or a script in your app's ``bin/``
- directory). If you edit the file locally and don't do ``silver
- update`` remember that it will use the old version of the script.
- The script must be a Python script. The path will be appropriately
- setup so all your libraries will be ready, and environmental variables
- set, and then the script will be run, passing all arguments you
- provide to the script.
- Also any arguments that you pass that point to a file or directory
- that exists will cause those files to be uploaded, and the remote
- filenames will be substituted. So in the example
- ``~/import-data.zip`` will be uploaded to the server.
- Note that these scripts can be run as ``www-data`` (the default) or
- you can use ``--user=www-mgr`` to run the script as ``www-mgr`` (the
- normal user used to manage the deployment of scripts) or
- ``--user=root`` to run the script as ``root``.