![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linux Shell Question: how to print the shell script name ? | meili100 | UNIX for Dummies Questions & Answers | 3 | 07-01-2008 01:55 PM |
| question about about Shell programming | thungmail | Shell Programming and Scripting | 1 | 04-01-2008 01:40 PM |
| shell question | convenientstore | Shell Programming and Scripting | 2 | 06-03-2007 05:05 PM |
| #!/bin/sh shell question | GCTEII | Shell Programming and Scripting | 0 | 02-23-2006 03:08 AM |
| Shell question | anjanb2 | UNIX for Dummies Questions & Answers | 5 | 07-03-2002 12:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 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 Any help appreciated. I will post my code if someone's interested. Daniel |
|
||||
|
Thanks, reborg, for you quick reply,
I think I wasn't clear enough. This is the code I wrote: Code:
#!/bin/sh HOME=/home/mvo PATH=/home/mvo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games echo -------------------------------------------- >> /home/mvo/backuplog echo Backup Started `date` >> /home/mvo/backuplog cd / if [ -d /home/backups/`date +%w`/ ] ; then rm /home/backups/`date +%w`/backup.tar.gz echo Overwriting Day `date +%w` starting now.. >> /home/mvo/backuplog else mkdir /home/backups/`date +%w`/ fi mkdir /home/backups/tmp mysqldump -u Username -pPassword Databasename | gzip > /home/backups/tmp/mysqldump.sql.dump.gz echo Database Backup Complete.. >> /home/mvo/backuplog cp -Rf /var/www /home/backups/tmp cp -Rf /home/groupoffice /home/backups/tmp tar czvf /home/backups/`date +%w`/backup.tar.gz /home/backups/tmp rm -Rf /home/backups/tmp echo GroupOffice Backup Complete.. >> /home/mvo/backuplog echo Backup Completed `date` >> /home/mvo/backuplog How can I get past this? I've tried sleep but I want to keep my script flexibel as the content of the backupdirs may change in size. So what I want to do is wait for a command to finish before calling a next command! Thanks for you help! Last edited by dswz; 06-30-2009 at 08:18 PM.. |
|
||||
|
did you check your mail for any message from cron ?
|
| Sponsored Links | ||
|
|