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
Backup script - HELP :( c00kie88 Shell Programming and Scripting 1 05-13-2008 08:23 PM
Backup script dan86 Shell Programming and Scripting 1 10-29-2007 08:47 PM
DB2 Backup Script jyoung UNIX for Dummies Questions & Answers 0 06-13-2005 01:59 PM
Backup Script geek4sur AIX 7 05-24-2005 11:31 AM
Help with a backup script SemperFi UNIX for Dummies Questions & Answers 5 07-22-2004 12:00 PM

Closed Thread
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
  #1 (permalink)  
Old 09-09-2005
pascal pascal is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 2
A backup script

Hello

I'm a new user of this forum. English is not my natural language so excuse me by advance if my sentences are not always really understandable :-p

Well here is my problem.

I use a panel and I need to use the backup command of this panel to backup all my customer account (created under this panel)
I may use an option like "backup --domains=*all" but in this case the backup command run during more than 3 hours and use huge ressources (cpu, etc..)
So my idea is to create a shell script to backup some domains every hours. For example every domains that begin by "A*" would be backuped at 01:00AM, every "B*" at 02:00AM, etc....

I have the list of all domains listed in /etc/httpd/conf.d

My idea is to do soemthing like this
Quote:
PATH2CONF=/etc/httpd/conf.d

CAse current hour = 01 then DOM = a*
Case current hour = 02 then DOM = b*
etc ...

RSLT=`ls -1 domain.com.conf_to_ignore /$PATH2CONF/$DOM`

for TOBACKUP in $RSLT; do
Remove the .conf at the end of domain.com.conf
BACKUP --domains=$tobackup
done
My two main problems are :
1/ I don't know how to write in SHELL command the line
Quote:
CAse current hour = 01 then DOM = a*
2/ I don't know how to remove the .conf at the end of the $TOBACKUP (domain.com.conf)

Of course it is not a very beautifull script. It could be best to calculate the number of existing domains then divise it by 24 hours and backup the result every hours, but for me it become to strong :-p so I prefere to begin by soemthing simple

There is maybe others solutions to not backup all my customer account in one shot but few per hours or days.

I'd really apreciate your help about my 2 mains pbms and all advises/comments you may give me to realise this.

Thanks a ton

Pascal
  #2 (permalink)  
Old 09-09-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
You can use the date command to extract the current hour.

Here is a starter script for you..


Code:
#! /bin/ksh

PATH2CONF=/etc/httpd/conf.d

HOUR=$(date +%H)

case $HOUR in
00) DOM=A ;;
01) DOM=B ;;
.
.
.
23) DOM=W ;;
esac


Look at this script to see how .conf is removed.


Code:
sh-2.05b$ ls
auth_mysql.conf  python.conf        ssl.conf
auth_pgsql.conf  perl.conf  README             
authz_ldap.conf  php.conf   squirrelmail.conf  welcome.conf


Code:
sh-2.05b$ for file in *
> do 
> echo ${file%.conf}
> done
auth_mysql
auth_pgsql
authz_ldap
perl
php
python
README
squirrelmail
ssl
welcome



Vino
  #3 (permalink)  
Old 09-09-2005
pascal pascal is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 2
thanks a ton

Pascal
Closed Thread

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 08:35 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