The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




Thread: Shell Question
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 06-30-2009
dswz dswz is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 2
Shell Question

Hi All,

I am having this problem and I can't find a decent answer anywere.
I'am trying to perform multiple command in a shell script.

For example

Code:
mkdir test
tar cvzf test.tar.gz test/
rmdir test

The problem I get is that if I run this file as a cronjob, with a big "test" folder; the rmdir is making targz incomplete.

I've been using the sleep command to stretch the amount of time so that the tar command has time enhough to finish, but I would like to make it more flexible.

What is the best way to do this.. I know the "command1 && command2" option but the backupscript I am trying to make is multiline..
Also tried:


Code:
command1 &
command2 &
command3

I am a shell beginner, but not a beginning programmer..

Any help appreciated. I will post my code if someone's interested.

Daniel