Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7734891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:21:51+00:00 2026-06-01T07:21:51+00:00

I have a ant target where I successfully use a sshexec-task to install a

  • 0

I have a ant target where I successfully use a sshexec-task to install a server using tomcat on OpenSuse 11.

My problem comes when I try to run a script that start the newly installed server.
I need to do this as root, so I use a task as this:

<sshexec host="${tss.hostname}"
    username="${username}"
    password="${password}"
    trust="true"
    Command="/usr/local/bin/foo/bar/tomcat/bin/startup.sh"
    failonerror="false"/>

The problem with this is that I need to run the script from the folder where it is located, as it finds CATALINA_HOME and JAVA_HOME from that location. And the path “foo/bar” will change over time so I do not want to set it permanently.
I just want to change my running path to the correct one.

As I failed to start the server like that, I wanted to investigate a bit and changed the script so I used “CommandResource=”cmd.txt” instead of a direct command. I thought I could use this to set CATALINA_HOME before I started the server and go around the problem that way.

This is the outcome when using cmd.txt:

  [sshexec] Connecting to foo-bar:22
  [sshexec] cmd : 
  [sshexec] cmd : cd /usr/local/bin/foo/bar/tomcat/bin
  [sshexec] cmd : pwd
  [sshexec] /root
  [sshexec] cmd : echo $PATH
  [sshexec] /usr/java/jdk1.6.0_27/bin:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
  [sshexec] cmd : export CATALINA_HOME=$PATH:/usr/local/bin/tibco/tss/4.5.0/tomcat
  [sshexec] cmd : echo $PATH
  [sshexec] /usr/java/jdk1.6.0_27/bin:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin

This shows that neither the cd nor export command have any effect.

I suspect I need to change the rights for ssh. I have read that I may need to change in .ssh/config. But I do not know how or where…

So, to sum this long question up short:

What do I need to do to be able to run my startup.sh as root from the correct tomcat/bin folder with a ant script that is run in Jenkins?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:21:53+00:00Added an answer on June 1, 2026 at 7:21 am

    Yeah I also faced the same problem. The cd command doesnot work from sshexec. Alternative is to put all the commands in some install.sh file and scp it to the remote machine. And then use sshexec commandresource to execute this file on the remote machine. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ant build target using csc: <target name=compile> <echo>Starting compiling ServiceLauncher</echo> <csc
I have built a Java/Swing Application and I have successfully deployed it using Ant,
I have written an Ant target that starts Selenium server, runs my test code,
I have an ant task set up like so: <target name=unit-test description=unit tests depends=compile-tests>
I have an ant target that echo's the content of an eclipse .project file,
I have an Ant copy task (defined in a Maven script invoked by a
We currently have an ant task that contains something similar to the following: <filelist
I have a ruby application that executes ant as a subprocess using backtick. This
Problem We have a server over which we have FULL control We have a
i have ant target which invokes simultaneously other 3 projects ant build target for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.