The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > Linux
.
google unix.com



Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with EXPECT script hanging markus2008 UNIX for Dummies Questions & Answers 0 03-11-2008 03:44 PM
can hanging perl process wipe out a directory? aboxilica UNIX for Advanced & Expert Users 2 02-26-2008 09:21 AM
script hanging - remsh vivsiv Shell Programming and Scripting 2 07-09-2006 03:41 PM
how to tell if process is hanging dangral UNIX for Dummies Questions & Answers 2 01-07-2004 08:43 AM
hanging sql script inquirer UNIX for Dummies Questions & Answers 4 12-26-2001 10:11 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-12-2008
brendan76 brendan76 is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 13
Script to simulate hanging process

I want to create a script to simulate a process that hangs to test a java application. My java app executes a system command, which can also be executing scripts, etc. Any ideas on such a script?

The java code is:

Code:
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("sh ./someTestScript.sh");
int exitValue = p.waitFor(); // If process hangs I don't get an exitValue
  #2 (permalink)  
Old 09-12-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,302
Something like:

Code:
#!/bin/sh

while :
do
  sleep 1
done
Regards
  #3 (permalink)  
Old 09-12-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Or just sh -c 'sleep 9876543210'
  #4 (permalink)  
Old 09-12-2008
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,322
Code:
perl -e 'while (1) { sleep ()}'
or just "cat" it will wait for input forever.
  #5 (permalink)  
Old 09-16-2008
brendan76 brendan76 is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 13
Cheers

Great, thanks everyone.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0