Shares rake tasks

IN THIS ARTICLE:

Overview

Rake tasks are scripts that allow you to retrieve, delete or update information on your Shares server using the command line. Rake tasks can perform actions on user accounts, shares and nodes.

For Shares 1.8 and later, rake tasks are included in your installation and are already available to use. For versions of Shares earlier than 1.8, you will need to download the attached zip file and follow the installation instructions to make use of rake tasks. However, we recommend that you consider upgrading your Shares to the 1.9 release if possible so that you can take advantage of improvements as well as have built in rake tasks.

If you need further assistance with the installation or usage of rake tasks, please contact Support.

 

Installing

Note: Installation of rake tasks is only necessary if you have a version of Shares earlier than 1.8.

1. Download the zip file attached at the end of this article.

2. Create a directory named data at the following location:

  • Linux: /opt/aspera/shares/u/shares/lib/tasks/data/
  • Windows: C:\Shares\www\lib\tasks\data

3. Copy the rake tasks to the data directory you just created.

4. (LINUX ONLY STEP) Update permissions on the data directory with the following commands:

# chown nobody:nobody R /opt/aspera/shares/u/shares/lib/tasks/data/
# chmod 644 R /opt/aspera/shares/u/shares/lib/tasks/data

 

Add the following lines to your ~/.profile file to set the RAILS_ENV environment variable and update the path environment variable:

export RAILS_ENV=production
export PATH=/opt/aspera/shares/bin/:$PATH

 

Validate that rake works with the following commands:

# cd /opt/aspera/shares/u/shares
# bundle exec rake -T

If it is working you will see a list of the available rake tasks.

 

Usage

Rake tasks must be run from within the appropriate location in the shares folder:

  • Linux Shares 1.8 and later: /opt/aspera/shares/u/shares/bin
  • Linux Shares earlier than 1.8: /opt/aspera/shares/u/shares
  • Windows: C:\Shares\www


The general syntax for a Shares rake task is the following:

<command for Linux> rake <rake task> -- <options>

 

The <command for Linux> is the command that executes the rake tasks on Linux, and does not apply to Windows. The <command> you need to use depends on your version of Shares:

  • Shares 1.8 and later: ./run
  • Shares earlier than 1.8: bundle exec


The rake task and the options it takes are separated by -- (double -). For example, if you run the rake task to delete user fredweasley, you would use the following:

Windows
rake data:user:delete -- --username fredweasley

Linux Shares 1.8+

./run rake data:user:delete -- --username fredweasley

Linux Shares below 1.8
bundle exec rake data:user:delete -- --username fredweasley


Shares rake task articles

You can find documentation of the available rake tasks with examples in the following links, based on the type of rake task:

User management rake tasks

Group management rake tasks

Shares management rake tasks

Node management rake tasks

Server configuration rake tasks

Active Directory rake tasks

 

Attachments

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk