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

  • Home
  • SEARCH
  • 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 8404285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:33:39+00:00 2026-06-09T22:33:39+00:00

I have a bash script on my server which fetches master branch from github,

  • 0

I have a bash script on my server which fetches master branch from github, builds it and deploys artifacts to the tomcat. I decided to write a github web URL hook which will call this sh. As my server is running Java, I’m using groovy. I writed a test script test.sh in /home/madhead/scripts:

echo "SHELL"
touch /home/madhead/test_`date +%d_%m_%Y_%H_%M_%S` # To see if script is actually called

Environment variable SCRIPTS is set to /home/madhead/scripts in /home/madhead/.bashrc. In my groovlet I have

println "GROOVY"
println '$SCRIPTS/test.sh'.execute().text
println `whoami'.execute().text` //Prints madhead
println `env'.execute().text` //Prints all environment variables for madhead, SHELL is /bin/bash and SCRIPTS is /home/madhead/scripts in this output.

“GROOVY” is printend in html, but no “SHELL” and no test files are created when i calling groovlet. So, the script is not called. I tried

println '/home/madhead/scripts/test.sh'.execute().text

in groovlet with no effect. How do i call bash script from groovy/java? Also, println 'echo test'.execute().text prints test to html, but println 'echo $SCRIPTS'.execute().text does not print anything. Why?

  • 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-09T22:33:40+00:00Added an answer on June 9, 2026 at 10:33 pm

    Maybe to get the environment variable you need to:

    def env = System.getenv()
    println env.SCRIPTS
    

    In my box this guy works:

    groovy -e ' def env = System.getenv(); println env.JAVA_HOME '
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Bash script on server A that finds the logged in SSH
I have a bash script which need to execute some php scripts and to
I have a bash script that sources contents from another file. The contents of
I have a bash script which I wrote that lists out some servers/user names.
I have written a small bash script which needs an ssh tunnel to draw
I have a strange problem with BASH script which I can't figure out. I
I have a form which uses $.ajax on submit to call a bash script
I have a log file from a web server which looks like this; 1908
I have a Bash script that builds a string to run as a command
i was making a bash script for my server which pack some directories with

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.