Script to simulate hanging process


 
Thread Tools Search this Thread
Operating Systems Linux Script to simulate hanging process
# 1  
Old 09-12-2008
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  
Old 09-12-2008
Something like:

Code:
#!/bin/sh

while :
do
  sleep 1
done

Regards
# 3  
Old 09-12-2008
Or just sh -c 'sleep 9876543210'
# 4  
Old 09-12-2008
Code:
perl -e 'while (1) { sleep ()}'

or just "cat" it will wait for input forever.
# 5  
Old 09-16-2008
Cheers

Great, thanks everyone.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget script to simulate real user visits

so i'm using the following script to attempt to simulate a user visiting a page but unfortunately, it doesn't look like this is working: wget -nv -r "http://www.mywebsite.com" does anyone have a better idea of how to do this? the goal here is to run a wget command from a linux host to a... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. Shell Programming and Scripting

How to simulate ''Esc'' keystroke in a bash shel script?

I am using Ubuntu 12.4 I am running the following script: ++++++++ #!/bin/bash while ; do xdotool mousemove 248 539 click 1 & sleep 3 done +++++++++ This moves the mouse on the specified position on the screen and clicks that pauses the script for 3 seconds and repeats the... (2 Replies)
Discussion started by: alfarnume
2 Replies

3. Solaris

How to simulate light weight process (LWP)?

Hello, We had a problem on a Solaris system (SunOS 5.10) that hit LWP limit and caused fork 11 error. Now we need to come up with a script to simulate and reproduce that scenario. What would be a simple and valid way to generate lots of Light Weight Processes? Thanks, Jay (1 Reply)
Discussion started by: seafan
1 Replies

4. Programming

Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX

Writing a Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX I have over the years come across the same issue a couple of times, and it normally is that the read speed on SAN is absolutely atrocious when doing non-sequential I/O to the disks. Problem being of... (7 Replies)
Discussion started by: vrghost
7 Replies

5. Shell Programming and Scripting

simulate linux shell using script

hi guys I was requested to create a script to simulate a linux shell so when the user opens linux he will get my linux menu with some options and one of those is a simulated linux shell this is my code #!/bin/ksh while do read whichcmd?"Enter Command: " $whichcmd ... (5 Replies)
Discussion started by: kopper
5 Replies

6. UNIX for Dummies Questions & Answers

Process Hanging

Hi! I have written a program three threads will be created to execute three different Sybase SQLs. so three thread will call a method runQuery. In run query again we create child process to execute the actuall SQL by connecting to the SQL. When I run the process first three threading working fine.... (0 Replies)
Discussion started by: jramesh1
0 Replies

7. Shell Programming and Scripting

simulate session.getMaxInactiveInterval() in bash script

hi everyone, I have a question about the java object oriented function which to simulate in bash script... here is the function "session.getMaxInactiveInterval() / 60 " got any web can read this function? coz i need to simulate to bash script... Hope someone give me a suggestion... (0 Replies)
Discussion started by: ryanW
0 Replies

8. Shell Programming and Scripting

Script is hanging

Hello, I have the following shell script and when i execute, it keeps hanging and nothing happens Please let me know. Requirement is to read data from file and pass it to the sql and create files as shown. code /******** #!/bin/sh while read user.dat do echo "user = $1 email =... (1 Reply)
Discussion started by: rakeshsr12
1 Replies

9. UNIX for Advanced & Expert Users

can hanging perl process wipe out a directory?

Hi, This weekend i left a perl script running , I was running it in a remote machine. The machine seems to have been rebooted during the weekend. When i got back on monday the entire directory containing the script was wiped out. The process had been aborted. Nobody has access to the directory... (2 Replies)
Discussion started by: aboxilica
2 Replies

10. UNIX for Dummies Questions & Answers

how to tell if process is hanging

On Solaris 8.. 28166 user 3693M 2736M sleep 5 0 0:05.38 0.0% PROCESS/4 How can I tell if this process is doing anything or just hanging? (2 Replies)
Discussion started by: dangral
2 Replies
Login or Register to Ask a Question