The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
debugging an already running bash script marcpascual UNIX for Advanced & Expert Users 1 01-20-2009 02:56 AM
Running a script from script (bash) bobban Shell Programming and Scripting 1 12-26-2008 02:20 AM
Running same script multiple times concurrently... ckhowe Shell Programming and Scripting 4 12-12-2007 06:39 PM
Command Not running in script Dastard Shell Programming and Scripting 2 05-21-2007 06:08 PM
Cannot running export database using bash script tovohery Linux 5 03-23-2007 02:27 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-19-2009
dj_bridges dj_bridges is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 5
Arrow Running function or command concurrently in a bash script

I currently run a script over a vpnc tunnel to back-up my data to a remote server. However for a number of reasons the tunnel often collapses. If I manually restore the tunnel then the whole thing can continue, but I want to add into my script a section whereby while the transfer is taking place, the system checks if the tunnel is still up and if not it resets it. I though I had it cracked (see below), but even though the $BREAK variablet change after the process code had run, it didn't escape the while loop so the script never ended. I therefore think I need a different way of doing it (by the way I am new to scripting so expect some ugly code).....

I am not asking someone to write this for me, but if you know of a function that I could use that would be most helpful..... Thanks in advance.....


Code:
function process ()
{
process code.....
BREAK=500
}

# ------------- the script itself --------------------------------------
BREAK=0

# First run Tunnel to get it up and running (a separate script).
Tunnel.sh

# Run process and the while loop at the same time.
process &
while [ $BREAK == 0 ]
do
   Tunnel.sh #Re-establishes connection if required
   sleep 15
done

 

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:51 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