How to pause a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to pause a shell script
# 1  
Old 03-02-2010
How to pause a shell script

Hi,

I've written a shell script to take photos with my camera.
After every picture taken, the picture is transmitted to the computer via usb and then deleted on the camera.
But sometimes there's an error and the picture is not deleted and so, after a certain time, the camera chip will be full.
When I try to delete the pictures on the camera manually, it'll shut down, because the script also wants to access it.

I don't wanna stop the script because it's quite a long complex measurement.
Is there a possibillity to pause the script somehow from outside?

Thank you very much!
# 2  
Old 03-02-2010
Hammer & Screwdriver Since it seems you are looking for a theory, and not code...

One approach to how a script could pause would be:

Code:
LOOP:
Do your stuff
Check to see if file exists
   If so, then wait for something to happen
   (such as, keystroke entry or file to be deleted)
goto LOOP

Thus, if the file does not exist - say PauseMyProgram.txt - then you will continue with the LOOP'ing. So if you want to pause your script, simply create the file PauseMyProgram.txt and your script will wait until you satisfy your next requirement.
# 3  
Old 03-02-2010
Thanks!
I'm not such a good coder.
Do you know how the code could look like?
# 4  
Old 03-02-2010
Code:
# Stop process
kill -s TSTP pid

# Continue/Resume process
kill -s CONT pid

# 5  
Old 03-02-2010
WOOHOO!!!!

THANKS!!!!!
Works perfectly!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pause before exit

6) printf "\n GoodBye! \n\n"; exit ;; I am trying modify the above command to pause a couple of seconds before exiting, so a message can be displayed. Thank you :). (8 Replies)
Discussion started by: cmccabe
8 Replies

2. Shell Programming and Scripting

Creating a script requiring a pause for user input

Hi I'm trying to create a basic script that pauses for user input to verify a file name before generating the output. I have numerous SSL certificate files which I am trying to determine the expiry date so what I'm trying to do is write a script so that is pauses to request the name of the .pem... (9 Replies)
Discussion started by: Buddyluv
9 Replies

3. Shell Programming and Scripting

How to have my ksh script pause, until something appears in the logs.?

All, Is there some way to have my KSH script pause, until the word "DONE!" appears in the logfile /logs/log.txt? Difficulty: The word "DONE!" may already be present in logs from the past. So I anticipate tail -0f may (somehow?) need to be done in the background, instead of grepping in a... (16 Replies)
Discussion started by: chatguy
16 Replies

4. Shell Programming and Scripting

Pause shell script till folder doesn't change size anymore

Hi, I recently would like to write a shell script that 1. Runs in the background (can be done with "&", but i'd be happy for other solutions to keep programs running) 2. Does its stuff 3 THEN checks a specified folder for a size change over time (say, each 5 seconds. AND ONLY continues with... (9 Replies)
Discussion started by: pasc
9 Replies

5. Shell Programming and Scripting

Pause for remote computing in Telnet script

I am running a telnet script that connects to a database server and executes sql scripts. While the remote database is processing the commands within the sql scripts, my telnet script continues to send commands. Okay, that's fine. They get queued up in the remote server and executed sequentially.... (3 Replies)
Discussion started by: oldjuke
3 Replies

6. Shell Programming and Scripting

Newbie question-do I pause and exec my shell scripts?

Hi there, I'm writing a script to restore 3 directories and 3 mysql db's every 24 hours. While writing the script, I came across the thought... Do I need to pause between executions? Example: msql restore1.sql rm -Rf path1/* cp -Rf path1/* /restore1 chmod 777 /folder1/cache1 ... (2 Replies)
Discussion started by: semiotics101
2 Replies

7. Shell Programming and Scripting

Script Pause Until Rsync Is Done Transferring

Alright, I have this script that pulls files from a few locations, process those files, creates a zip file, rsync's it and then removes everything. The problem that I'm having is that I do not know how large the rsync'ed zip file is going to be. Right now I'm using a sleep command before I... (4 Replies)
Discussion started by: droppedonjapan
4 Replies

8. Shell Programming and Scripting

the shell not pause when execute read command

Hi, i facing a problem when run the script below.. while do if then printf "Please enter a name : " read response # the problem occur here if then ea_ident=${omc_ident} else # # Check that name does not contain invalid... (14 Replies)
Discussion started by: neruppu
14 Replies

9. UNIX for Dummies Questions & Answers

pause needed for corn shell

I need a user pause for a script file, like the pause command in dos. please help I thought it was the corn shell it is csh. (7 Replies)
Discussion started by: dennysavard
7 Replies

10. UNIX for Dummies Questions & Answers

how to pause another process?

I guess I posted in wrong forum before. How do I pause another process and then restart it on linux? The other process doesn't listen for anything. Thanks for any help you can offer. Dane :confused: (1 Reply)
Discussion started by: daneensign
1 Replies
Login or Register to Ask a Question