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 6001645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:51:51+00:00 2026-05-23T00:51:51+00:00

I hava a .sh script which glues many other scripts, called by jsch ChannelExec

  • 0

I hava a .sh script which glues many other scripts, called by jsch ChannelExec from a windows application.

Channel channel = session.openChannel("exec");

((ChannelExec) channel).setCommand("/foo/bar/foobar.sh");

channel.connect();

if I run the command like “nohup /foo/bar/foobar.sh >> /path/to/foo.log &”, all the long term jobs(database operations, file processing etc.) seems to get lost.

checking the log file, only find those echo stuffs(before and after a long term operation, calculate running time etc.).

I checked the permissions, $PATH, add source /etc/profile to my .sh yet none of these works.

but when I run the command normally (sync run, print all echo outputs to my java client on windows),all the things goes well.

it’s a really specific prob.
Hope someone with experience can help me out.

thank in advance.

Han

  • 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-05-23T00:51:52+00:00Added an answer on May 23, 2026 at 12:51 am

    Solved!

    A different issue that often arises in
    this situation is that ssh is refusing
    to log off (“hangs”), since it refuses
    to lose any data from/to the
    background job(s).[6][7] This problem
    can also be overcome by redirecting
    all three I/O streams.

    from
    http://en.wikipedia.org/wiki/Nohup

    My prob is, psql and pg_bulkload print their outputs to err stream.

    In my script, I didn’t redirect err streams.

    Everything went fine by also redirecting err streams to the same log file.

    nohup foo.sh > log.log 2>&1 &
    

    Thanks to Atsuhiko Yamanaka, he created a great JSch library, and Paŭlo Ebermann for the documentation.

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

Sidebar

Related Questions

I hava a PHP script which generates a PDF file (i'm using fpdf from
I hava a data window object, in which I am fetching some attributes from
I'm programming an MVC3 application. Now I hava to call a script if the
I hava a webview showing some contents which is getting from server. Now on
I hava a Background Worker and a DataGrid in my c# Application. In do
I'd like to hava a Dojo dojox.grid.DataGrid with its data from a servlet. Problem:
I hava the sql as below: select a.dept, a.name from students a group by
I hava a JFrame with multiple JPanels of similar width aligned one below other.
I hava a script that consist of hello world and the hello and world
Whether you structure your PHP application yourself or use a framework (MVC or other),

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.