ClientControl

Controlling Ubuntu One Client

First of all, applet is no longer present in Ubuntu One installation. It was necessary until the system components become decoupled enough and therefore the plan to remove it existed from the beginning.

Additionally the applet started to be abused to report the bug reports for all other ubuntu components.

The applet was the service that provided the notifications, notifications are no longer displayed to the user.

Ubuntu One Client Components:

  • ubuntuone-login
  • ubuntuone-syncdaemon
  • ubuntuone-preferences
  • u1sdtool

You will not interact with ubuntuone-login directly, this is a service that is used for ubuntuone OAuth login. ubuntuone-syncdaemon or SD for short is the main component of the file sync service. This application is watching the file changes and uploads/downloads the files when needed. ubuntuone-preferences is the GUI tool to control various aspects of Ubuntu One service. Currently it can show your user info, quota usage and control syncdaemon connectivity.

u1sdtool is a command line application that was not that much used earlier. Currently it supports everything you need to control your syncdaemon:

Usage: u1sdtool [option]

Options:
  -h, --help            show this help message and exit
  -w, --wait            Wait until ubuntuone-syncdaemon reaches nirvana
  --accept-share=SHARE_ID
                        Accept the share with the specified id
  --reject-share=SHARE_ID
                        Reject the share with the specified id
  --list-shares         Get the list of shares
  --refresh-shares      Request a refresh of the list of shares to the server
  --offer-share=PATH USER SHARE_NAME ACCESS_LEVEL
                        Share PATH to USER.
  --list-shared         List the shared path's/shares offered.
  --create-folder=PATH  Create user defined folder in the specified path
  --delete-folder=FOLDER_ID
                        Delete user defined folder in the specified path
  --list-folders        List all the user defined folders
  --subscribe-folder=FOLDER_ID
                        Subscribe to the folder specified by id
  --unsubscribe-folder=FOLDER_ID
                        Unsubscribe from the folder specified by id
  --publish-file=PATH   Publish file publicly.
  --unpublish-file=PATH
                        Stop publishing file publicly.
  --refresh=PATH        Request a refresh of PATH
  --info=PATH           Request the metadata of PATH
  --current-transfers    show the current uploads and downloads
  -q, --quit            Shutdown the syncdaemon
  -c, --connect         Connect the syncdaemon
  -d, --disconnect      Disconnect the syncdaemon
  -s, --status          Get the current status of syncdaemon
  --waiting-content     Get the waiting content list
  --waiting-metadata    Get the waiting metadata list
  --schedule-next=SHARE_ID NODE_ID
                        Move the node to be the next in the queue of waiting
                        commands
  --start               Start syncdaemon if it's not running

Startup and shutdown

Syncdaemon can be autostarted by dbus if something requires it. You might want to use the following switches:

  • --start - starts syncdaemon
  • --connect - asks syncdaemon to connect to UbuntuOne service. Syncdaemon will not connect to it on startup.

  • --status - asks syncdaemon about its status:

    State: QUEUE_MANAGER
        connection: With User With Network
        description: processing queues
        is_connected: True
        is_error: False
        is_online: True
        queues: IDLE

If you need to quit syncdaemon gracefully then you will need to use --quit switch:

$ u1sdtool --quit
ubuntuone-syncdaemon stopped.

Queues

Syncdaemon has two queues that are used to communicate with the server:

  • Metadata queue contains items that describe your data to the server or request the information from the server. Examples of metadata items are MakeFile, ListDir and Unlink. These items do not actually upload or download your content and currently it is mandatory for all metadata queue items to be processed before content queue starts to be processed. Metadata queue can be examined by running u1sdtool --waiting-meta.

  • Content queue contains the actual uploads/downloads. Once the file has finished uploading/downloading the content queue item is removed from the queue. Content queue can be examined by running u1sdtool --waiting-content.

In Ubuntu 11.04 and 11.10 these two commands have been combined into -  u1sdtool --waiting 

You can get the number of items in the queue, useful for gauging sync progress, with the command -  u1sdtool --waiting | wc -l 

You can also see the current state of processing for the content queue item using --current-transfers option:

$ u1sdtool --current-transfers
Current uploads:
  path: /home/rtg/Ubuntu One/museum10.kmz
    deflated size: 977666
    bytes written: 326180
Current downloads: 0

File publishing

To publish the file use --publish-file switch. Please note that this option requires full path to the file to be published and this file should be within Ubuntu One folder or UDF:

$ u1sdtool --publish-file "/home/rtg/Ubuntu One/museum10.kmz"
File is published at http://ubuntuone.com/p/4RQ/

If you no longer want to have the file published, use --unpublish-file option:

$ u1sdtool --unpublish-file=/home/rtg/Ubuntu\ One/museum10.kmz 
File is not published

User Designated Folders

If you want to add a folder to Ubuntu One then you will need to use --create-folder option. This operation can take some time and even timeout but in fact the request was added to the metadata queue:

$ u1sdtool --create-folder=/home/rtg/Music/

(you might want to look at metadata queue)

$ u1sdtool --waiting-meta
 CreateUDF

When UDF is created your files will start syncing from that folder.

You can see what folders are synced to Ubuntu One using --list-folders switch:

$ u1sdtool --list-folders
Folder list:
  id=20b0b044-523f-462a-8938-7e2fa16030b0 subscribed=True path=/home/rtg/Public
  id=3c928fd5-295a-480f-9dee-88aaca05d33a subscribed=True path=/home/rtg/Music
  id=a19bb966-a0e9-4f05-a927-f9fc81986258 subscribed=True path=/home/rtg/.ubuntuone/Purchased from Ubuntu One
  id=5577d808-6a3f-4873-8b27-1fd644bd7e20 subscribed=True path=/home/rtg/Documents

If you no longer want to sync the folder to Ubuntu One you can remove the UDF via --delete-folder. Please use the folder ID that is printed by --list-folders. This command does not delete anything from your filesystem but the corresponding folder will be removed from your cloud storage

$ u1sdtool --delete-folder=3c928fd5-295a-480f-9dee-88aaca05d33a

Folder Subscription

There is a not very well known feature that allows you to have UDFs or Share synchronized to one machine but not be synchronized on another one. In case the machine is subscribed to the folder then the contents will be synchronized. This is a per-machine setting.

E.g. if you have the collection of Music that you want to have on your desktop and netbook but not on your laptop the following can be used:

  • On desktop - create the UDF - u1sdtool --create-folder=/home/rtg/Music/

  • On laptop - unsubscribe from UDF - u1sdtool --unsubscribe-folder=3c928fd5-295a-480f-9dee-88aaca05d33a

In this case the data in Music folder on your desktop and netbook will not be synced to laptop. If you need to start syncing the folder again then use

u1sdtool --subscribe-folder=3c928fd5-295a-480f-9dee-88aaca05d33a

Shares

Creating shared folders

If you want to share a folder with another user you will need their email address:

u1sdtool --offer-share=/home/rtg/Ubuntu\ One/Backup/ testuser@example.net Backup Modify

In this case "/home/rtg/Ubuntu One/Backup/" folder will be shared with testuser@example.net. The share will be named Backup and the user will be able to Modify its contents. In case you specify anything else for access level (i.e. View) then the share will be read-only.

Listing your shares

The folders you have shared with somebody else can be listed using --list-shared:

$ u1sdtool --list-shared
Shared list:
  id=60091c21-7573-445d-9270-0b6f8aedcec7 name=Backup accepted=True ↩
     access_level=Modify to=https://login.ubuntu.com/+id/BKRsnfL ↩
     path=/home/rtg/Ubuntu One/Backup

Listing folders shared with you

Accepted shares can be listed using --list-shares:

$ u1sdtool --list-shares
Shares list:
 id=7ac83011-42a6-41bf-9f0d-a19ab14ae28f name=Testing ↩
    accepted=True access_level=Modify ↩
    from=https://login.ubuntu.com/+id/BKQsnfL

Unsubscribing from folders

You can also unsubscribe from the shared folder - see above. Use the id from --list-shared to subscribe/unsubscribe to/from the folder.

While it is possible to accept and reject shares from the client there are no notifications sent from the server that could inform you about pending shares at the moment so --accept-share and --reject-share are useless for now (IMHO).

File information

You can see the metadata for the file using --info switch:

$ u1sdtool --info=/home/rtg/Ubuntu\ One/museum10.kmz 
 File: /home/rtg/Ubuntu One/museum10.kmz
  info_created: 1274290219.78
  info_is_partial: False
  info_last_uploaded: 1274290272.3
  info_node_id_assigned: 1274290245.15
  is_dir: False
  local_hash: sha1:da3f564e3ebcd8cf53420e50a616de7a4a63c288
  mdid: 11bd1897-d572-4756-99a2-5314312e2216
  node_id: 5e2ef3f6-d787-4965-a42a-f9d8ac13d8fc
  path: /home/rtg/Ubuntu One/museum10.kmz
  server_hash: sha1:da3f564e3ebcd8cf53420e50a616de7a4a63c288
  share_id: 
  stat: posix.stat_result(st_mode=33188, st_ino=8129494, st_dev=2055L, st_nlink=1, st_uid=1000, st_gid=1000, st_size=1008950, st_atime=1274290219, st_mtime=1274129516, st_ctime=1274290219)

File is considered synchronized if local_hash and server_hash are not empty and they are equal.

Accidentally added an UDF, how to remove it fast

  1. u1sdtool --list-folders - note the ID that is used by new UDF
  2. u1sdtool --unsubscribe-folder=$ID (where $ID = id that was received by running list-folders)
  3. u1sdtool --quit - this will quit the syncdaemon and drop the queue
  4. u1sdtool --start - start syncdaemon again, but do not connect
  5. (in new terminal, since this will not release the terminal right away) - u1sdtool --delete-folder=$ID
  6. u1sdtool --connect

RomanYepishev/UbuntuOne/ClientControl (last edited 2011-10-17 21:37:46 by duanedesign)