PageRenderTime 203ms CodeModel.GetById 101ms app.highlight 1ms RepoModel.GetById 100ms app.codeStats 0ms

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