1 2 3 Previous Next 40 Replies Latest reply on Jun 27, 2017 6:36 AM by Anthony Chamberas

    HOWTO: tabcmd on Linux - step-by-step guide

    Tamas Foldi

      [Update: for tableau 9 tabcmd click here]

       

      So, I have ported the tabcmd application to Linux, from java to native ruby, thus it can work on any platform. If someone needs this for his own environment, here are the steps what I did:

       

      Step 0: You must have ruby and rubygems installed on your system. No java is required.

       

      Step 1. Copy tabcmd.jar from Windows to your linux/unix box

       

      Step 2. Unzip contents of tabcmd.jar to a clean directory.

       

      $ unzip ~/tabcmd.jar

      $ ~/tabcmd


      Step 3. Install all required gems

       

      $ gem install `for i in ../../gems/*  ; do (echo \`basename $i\` | cut -f 1 -d '-') ; done `

       

      Step 4. Remove tabutils references

       

      rm ~/tabcmd/rb/tabcmd/common/ruby/lib/tabutil.rb

      vim ~/tabcmd/rb/tabcmd/common/ruby/lib/dump_reporter.rb

       

      Change contents to:

       

      #require 'tabutil'

      class DumpReporter

        def initialize(app_name, log_dir, exit_on_exception)

        end

        def self.setup(app_name, log_dir, exit_on_exception)

          $dump_reporter = DumpReporter.new(app_name, log_dir, exit_on_exception)

        end

        def self.force_crash

        end

      end

       

      Step 5. Set APPDATA directory

       

      $ export APPDATA=~

       

      Step 6. Remove java specific relative path from relative_path.rb

       

      $ vim ./common/ruby/lib/relative_path.rb

       

      Change the line 8 to:

       

      #    tableau_working_dir = java.lang.System.get_property("tableau.working.dir")

          tableau_working_dir = "."

       

      Step 7. Add execute flag to tabcmd.rb

       

      $ chmod +x bin/tabcmd.rb

       

      How it works:

       

      [root@gp-linux tabcmd]# bin/tabcmd.rb login -U admin -s http://192.168.8.162:8040

      ===== Creating new session

      =====     Server:   http://192.168.8.1:8040/

      =====     Username: admin

      Password:

      ===== Connecting to server...

      ===== Logging in...

      ===== Login Succeeded.

      [root@gp-linux tabcmd]# ruby bin/tabcmd.rb get views/Sample/Dashboard/admin/View4.csv

      ===== Continuing previous session

      =====     Server:   http://192.168.8.1:8040/

      =====     Username: admin

      ===== Requesting views/Sample/Dashboard/admin/View4.csv from server...

      ===== Saved views/Sample/Dashboard/admin/View4.csv to /root/tabcmd/View4.csv.

      ===== Succeeded

       

       

      Enjoy

        • 2. Re: HOWTO: tabcmd on Linux - step-by-step guide
          Dan Huff

          That is pretty darn cool!

          • 3. Re: HOWTO: tabcmd on Linux - step-by-step guide
            Francisco Cha

            I am having a hard time trying to install the gems. What version of ruby, rubygems and tabcmd are you using?

             

            gem install `for i in ../../gems/*  ; do (echo \`basename $i\` | cut -f 1 -d '-') ; done `

            ERROR:  While executing gem ... (Zlib::GzipFile::Error)

                not in gzip format

             

            Thank you,
            Francisco Cha

            • 4. Re: HOWTO: tabcmd on Linux - step-by-step guide
              Tamas Foldi

              Do you have internet access? This error usually means, that you cannot grab the packages from rubygems.org.

               

              Check: http://stackoverflow.com/questions/3059175/not-in-gzip-format-error

               

              However, I will ask my colleague to share his way of Linux porting. He did the porting in a different way, instead of using native ruby he just changed few classes in the tabcmd.jar. So yes, there many ways to make tabcmd working on linux.

               

              In the meanwhile we moved a few tableau services to linux, and they are working quite well. I am working to to move the whole tableau server to linux (DLLs will executed by WINE), so I will keep you updated.

              • 5. Re: HOWTO: tabcmd on Linux - step-by-step guide
                Francisco Cha

                Thank you for the quick response. You were correct my server did not have internet access. I was able to fix that issue however I ran into some other errors:

                 

                ERROR:  Could not find a valid gem 'bouncy' (>= 0) in any repository

                ERROR:  Possible alternatives: bounce, bunch, bouncer, bunny, mounce

                ERROR:  Could not find a valid gem 'jruby' (>= 0) in any repository

                ERROR:  Possible alternatives: cruby, gruby, ruby, vruby

                ERROR:  Could not find a valid gem 'ruby' (>= 0) in any repository

                ERROR:  Possible alternatives: ruby

                ERROR:  Could not find a valid gem 'ruby' (>= 0) in any repository

                ERROR:  Possible alternatives: ruby

                • 6. Re: HOWTO: tabcmd on Linux - step-by-step guide
                  Tamas Foldi

                  OK, then here is one of my customer's method for porting (thanks Zoltan). As I moved everything under ruby, he just leaves everything under jruby.

                   

                  Copy the tabcmd.jar file from c:\Program Files (x86)\Tableau\Tableau Server\7.0\bin\ to an empty directory and unpack it.

                  > jar xf tabcmd.jar

                  > rm tabcmd.jar

                  Modify tabcmd/common/ruby/lib/tabutil.rb so it looks like this:

                  require 'java'

                  #require 'tab-tabutil-dll.jar'

                  #Tabutil = com.tableausoftware.tabutil.dll 

                  module Tabutil

                   

                  def self.force_fault

                  end

                   

                    class Tabutil

                       def self.setup_fault_reporting(p1, p2, p3, p4)

                       end

                     end

                   

                  end

                  When done, pack up the whole thing back into a jar file:

                  > jar cf tabcmd.jar . 

                  When you have the jar, create a command file to run it with the following contents:

                  #!/bin/bash

                  export APPDATA=.

                  java -jar tabcmd.jar "$@"

                  Grant executable permission to the file and you're done:

                  > chmod u+x tabcmd 

                  Test with:

                  ./tabcmd login --server http://192.168.8.162:8040 --username emarsys
                  • 7. Re: HOWTO: tabcmd on Linux - step-by-step guide
                    Ben Sullins

                    After following the second set of instructions here I received the following error:

                     

                    Failed to load Main-Class manifest attribute from tabcmd.jar

                     

                    A colleague of mine was able to help me resolve this by adding the following additional steps:

                     

                    1. Create a new file inside the directory you have extracted the jar named "manifest.txt"
                    2. In the file add the following text: Main-Class: JarMain
                    3. Now package up the Jar with the following command: jar cfm tabcmd.jar manifest.txt .

                     

                    This tells Java which one is the Main class inside the jar to execute. Hope this helps!

                     

                    PS - You can also just download the updated jar from the following link: tabcmd.jar

                     

                    Message was edited by: Ben Sullins

                    • 8. Re: HOWTO: tabcmd on Linux - step-by-step guide
                      Ben Sullins

                      I've also converted this over for version 8 if anyone else out there was looking for this. The same steps above work but to save you the time here is the jar and executable.

                       

                      To get this working simply download both files to somewhere on your linux/mac box. Then from terminal browse to this directory and execute commands like so:

                       

                      ./tabcmdexe login --server http://127.0.0.1 --username MyUsername --password MyPassword

                      • 9. Re: HOWTO: tabcmd on Linux - step-by-step guide
                        Ben Sullins

                        in the v8 version of this, I'm getting the following error. Thoughts?

                         

                        $ ./tabcmdexe listsites

                         

                        *** Using highline effectively in JRuby requires manually installing the ffi-ncurses gem.

                        *** jruby -S gem install ffi-ncurses

                        ===== Creating new session

                        =====     Server:   https://myserver/

                        =====     Username: myusername

                        Password: stty: stdin isn't a terminal

                        stty: stdin isn't a terminal

                        • 10. Re: HOWTO: tabcmd on Linux - step-by-step guide
                          Justyn Attwool

                          Hi Ben,

                           

                          I have no problems doing a listsites , but I do a login first - is the commands I want , then logout

                           

                          $ ./tabcmdexe version

                          *** Using highline effectively in JRuby requires manually installing the ffi-ncurses gem.

                          *** jruby -S gem install ffi-ncurses

                          ===== Tableau Server Command Line Utility -- Version 8000.13.0319.1225

                          $

                           

                          $ ./tabcmdexe login -u admin -p mypasswd --server https://myserver --no-certcheck

                          *** Using highline effectively in JRuby requires manually installing the ffi-ncurses gem.

                          *** jruby -S gem install ffi-ncurses

                          ===== Creating new session

                          =====     Server:   https://myserver/

                          =====     Username: admin

                          ===== Connecting to server...

                          ===== Logging in...

                          ===== Login Succeeded.

                           

                          $ ./tabcmdexe listsites --no-certcheck

                          *** Using highline effectively in JRuby requires manually installing the ffi-ncurses gem.

                          *** jruby -S gem install ffi-ncurses

                          ===== Continuing previous session

                          =====     Server:   https://myserver/

                          =====     Username: admin

                          ===== Listing sites for user admin...

                          ===== Succeeded

                          =====

                           

                           

                          NAME: Default

                          SITEID: ""

                           

                           

                          NAME: Training

                          SITEID: "Train"

                          • 11. Re: HOWTO: tabcmd on Linux - step-by-step guide
                            Justin Smith

                            Thank you Tamas for this, and thank you Ben for the final product links as well as version 8. This will certainly help out my institution when we move forward with our Server installation. I spoke with one of my IT guys the other day, and mentioned I saw a ported Linux version of Tabcmd and his eyes lit up. I think he will utilize this a lot.

                             

                            Thanks again for your contributions,

                            Justin

                            • 12. Re: HOWTO: tabcmd on Linux - step-by-step guide
                              Ben Sullins

                              Thanks Justyn, yeah I had accidentally ported over the beta v8 and it wasn't working. I got a fresh copy of the .jar and redid the process and it worked fine.

                              • 13. Re: HOWTO: tabcmd on Linux - step-by-step guide
                                Justyn Attwool

                                Thats great Ben, glad you got it working.

                                 

                                Yep I built my jar from an 8 scratch.

                                • 14. Re: HOWTO: tabcmd on Linux - step-by-step guide
                                  Philippe Verhaeghe

                                  Hello,

                                  I tried this on my linux server, but I the error listed below.

                                  Any suggestion to solve this ?

                                  Thanks,

                                  Philippe

                                   

                                  java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: /tmp/jffi3888236194056693819.tmp: /tmp/jffi3888236194056693819.tmp: failed to map segment from shared object: Operation not permitted

                                  at com.kenai.jffi.Foreign$InValidInstanceHolder.getForeign(Foreign.java:90)

                                  at com.kenai.jffi.Foreign.getInstance(Foreign.java:95)

                                  at com.kenai.jffi.Library.openLibrary(Library.java:151)

                                  at com.kenai.jffi.Library.getCachedInstance(Library.java:125)

                                  at com.kenai.jaffl.provider.jffi.Library.loadNativeLibraries(Library.java:66)

                                  at com.kenai.jaffl.provider.jffi.Library.getNativeLibraries(Library.java:56)

                                  at com.kenai.jaffl.provider.jffi.Library.getSymbolAddress(Library.java:35)

                                  at com.kenai.jaffl.provider.jffi.Library.findSymbolAddress(Library.java:45)

                                  at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:188)

                                  at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:110)

                                  at com.kenai.jaffl.provider.jffi.Provider.loadLibrary(Provider.java:31)

                                  at com.kenai.jaffl.provider.jffi.Provider.loadLibrary(Provider.java:25)

                                  at com.kenai.jaffl.Library.loadLibrary(Library.java:76)

                                  at org.jruby.ext.posix.POSIXFactory$LinuxLibCProvider$SingletonHolder.<clinit>(POSIXFactory.java:108)

                                  at org.jruby.ext.posix.POSIXFactory$LinuxLibCProvider.getLibC(POSIXFactory.java:112)

                                  at org.jruby.ext.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:30)

                                  at org.jruby.ext.posix.LinuxPOSIX.<init>(LinuxPOSIX.java:17)

                                  at org.jruby.ext.posix.POSIXFactory.loadLinuxPOSIX(POSIXFactory.java:70)

                                  at org.jruby.ext.posix.POSIXFactory.loadPOSIX(POSIXFactory.java:31)

                                  at org.jruby.ext.posix.LazyPOSIX.loadPOSIX(LazyPOSIX.java:29)

                                  at org.jruby.ext.posix.LazyPOSIX.posix(LazyPOSIX.java:25)

                                  at org.jruby.ext.posix.LazyPOSIX.setenv(LazyPOSIX.java:275)

                                  at org.jruby.RubyGlobal$StringOnlyRubyHash.case_aware_op_aset(RubyGlobal.java:177)

                                  at org.jruby.RubyGlobal$CaseInsensitiveStringOnlyRubyHash.op_aset(RubyGlobal.java:88)

                                  at org.jruby.RubyHash$i$2$0$op_aset.call(RubyHash$i$2$0$op_aset.gen:65535)

                                  at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:332)

                                  at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:203)

                                  at org.jruby.ast.OpElementOneArgOrAsgnNode.interpret(OpElementOneArgOrAsgnNode.java:70)

                                  at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)

                                  at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)

                                  at org.jruby.ast.RootNode.interpret(RootNode.java:129)

                                  at org.jruby.evaluator.ASTInterpreter.INTERPRET_ROOT(ASTInterpreter.java:119)

                                  at org.jruby.Ruby.runInterpreter(Ruby.java:724)

                                  at org.jruby.Ruby.loadFile(Ruby.java:2487)

                                  at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:66)

                                  at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:745)

                                  at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:332)

                                  at org.jruby.runtime.load.LoadService.require(LoadService.java:379)

                                  at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:304)

                                  at org.jruby.RubyKernel.requireCommon(RubyKernel.java:1050)

                                  at org.jruby.RubyKernel.require(RubyKernel.java:1033)

                                  at org.jruby.RubyKernel$s$1$0$require.call(RubyKernel$s$1$0$require.gen:65535)

                                  at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:319)

                                  at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)

                                  at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)

                                  at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)

                                  at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)

                                  at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)

                                  at org.jruby.ast.RescueNode.executeBody(RescueNode.java:216)

                                  at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:120)

                                  at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)

                                  at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)

                                  at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)

                                  at org.jruby.ast.RootNode.interpret(RootNode.java:129)

                                  at org.jruby.evaluator.ASTInterpreter.INTERPRET_ROOT(ASTInterpreter.java:119)

                                  at org.jruby.Ruby.runInterpreter(Ruby.java:724)

                                  at org.jruby.Ruby.runInterpreter(Ruby.java:732)

                                  at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:120)

                                  at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1263)

                                  at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1256)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                                  at java.lang.reflect.Method.invoke(Method.java:606)

                                  at JarMain.launchJRuby(JarMain.java:98)

                                  at JarMain.start(JarMain.java:111)

                                  at JarMain.main(JarMain.java:136)

                                  Caused by: java.lang.UnsatisfiedLinkError: /tmp/jffi3888236194056693819.tmp: /tmp/jffi3888236194056693819.tmp: failed to map segment from shared object: Operation not permitted

                                  at java.lang.ClassLoader$NativeLibrary.load(Native Method)

                                  at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1957)

                                  at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1882)

                                  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)

                                  at java.lang.Runtime.load0(Runtime.java:795)

                                  at java.lang.System.load(System.java:1061)

                                  at com.kenai.jffi.Init.loadFromJar(Init.java:164)

                                  at com.kenai.jffi.Init.load(Init.java:78)

                                  at com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:49)

                                  at com.kenai.jffi.Foreign$InstanceHolder.<clinit>(Foreign.java:45)

                                  at com.kenai.jffi.Foreign.getInstance(Foreign.java:95)

                                  at com.kenai.jffi.Internals.getErrnoSaveFunction(Internals.java:44)

                                  at com.kenai.jaffl.provider.jffi.StubCompiler.getErrnoSaveFunction(StubCompiler.java:68)

                                  at com.kenai.jaffl.provider.jffi.StubCompiler.<clinit>(StubCompiler.java:18)

                                  at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:146)

                                  ... 58 more

                                  LoadError: load error: META-INF/init -- java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: /tmp/jffi3888236194056693819.tmp: /tmp/jffi3888236194056693819.tmp: failed to map segment from shared object: Operation not permitted

                                    require at org/jruby/RubyKernel.java:1033

                                     (root) at <script>:2

                                  1 2 3 Previous Next