How to keep program running in background in ash shell


I need to SSH to an embedded device, launch a background program, then disconnect and keep the background process running. The problem is that the embedded device is using the ash shell (NOT bash or anything else), so nohup and screen are NOT available. I have not been able to find any way of disconnecting the process in ash. Is there any way of doing this in ash?


An alternative to:

nohup command &

Using clever parentheses:

(( command & ) & )

And also if you want to drop stdin/stdout:

(( command 0<&- &>/dev/null &) &) <h2>Explanation</h2>

TLDR: We made a subshell start a subshell to execute a command, thus starting an orphan process. Orphans only die when the init process dies.

The difference between putting subshell in background vs putting command in background is that subshells have different process states

When you log out of an SSH session or close any sh shell session a SIGHUP signal is sent to all of the child processes of that shell. What we did here is we started a subshell to start a subshell, thus disowning the started process. We now have an orphan process.

This orphaned process no longer has a PPID (parent process ID) that identifies with our SSH session. So when we logout of the SSH session and a SIGHUP is sent to all of our child processes, it never hits the orphan.



  • Camel JPA query parameters not being seen
  • Gravity of two side-by-side TextViews
  • iOS framework does not work on simulator
  • How to reference type of self in Typescript interface (for a IClonable interface)
  • XPATH: select subset of xml file
  • Show Currency Symbol after values
  • Determine if an element is a form field
  • Set Visual Studio Code to be global Git editor on OSX
  • What is url encoding %2526?
  • SailsJS user access levels and roles
  • Android MediaPlayer: getDuration() returns 0 after prepare()
  • Can't access android device from DDMS
  • iPhone/iPad: animated splash screen?
  • Flexible array member and pointer member : pros and cons?
  • perl - Math with duplicate entries in array
  • Laravel: Google contacts API gives empty results
  • Sending EoS to filesink while removing branch from tee
  • “We were able to connect to the database server” error in WordPress
  • Substatemachine
  • python & suds “ImportError: cannot import name getLogger”
  • java string index out of bound exception
  • how can I access to a hashed key stored by spring redis session using RedisTemplate?
  • how to make all possible power set(or subset) from arrayList objects?
  • Calling JavaScript function in WebView
  • Integrating Yelp API v2 into iOS 7 app
  • Calling UDF on Dataframe with Serialization Issue
  • async GET request with body from browser
  • I need a PHP mySQL Login script that directs user to specific URL based on username and password
  • Sample deviceQuery cuda program
  • Controller or RestController
  • Year over Year Stats from a Crossfilter Dataset
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Ruby regex for matching simpliest Ruby's regexes
  • Create an average of multiple excel chart without the data source
  • Why is ordered choice in pyparsing failing for my use case?
  • Google App Engine Datastore: Dealing with eventual consistency
  • ssh remote server login script