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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Filesystem creation over existing Directory TheDoc AIX 0 04-03-2006 05:18 AM
creation of unwanted directory mridula High Level Programming 6 10-05-2005 08:40 AM
Mass directory creation? AeroEngy UNIX for Dummies Questions & Answers 6 07-21-2005 09:57 AM
directory creation sveera UNIX for Advanced & Expert Users 4 05-17-2005 10:06 AM
Remote directory creation srinivay UNIX for Advanced & Expert Users 5 11-05-2004 02:56 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-05-2008
Registered User
 

Join Date: Aug 2007
Location: Bangalore
Posts: 288
Directory Creation problem

Hiiii,

here is my script--
Code:
BackupLocation="$OPTARG"
                if [[ $LFlag -eq 1 ]]; then
                        echo "Either option l or L should be given to $Programname"
                        echo "$Usage"
                        echo "$Programname is terminated"
                        return $ERR;
                fi
                if [[ $isBackUp -eq 1 ]];
                then
                        if [[ ! -d $BackupLocation ]];
                           then
                                echo "Non-existant directory specified"
                        fi
                               #givenPath="$BackupLocation"
                                BackupLocation=$BackupLocation/backup
                                mkdir -p $BackupLocation >/dev/null 2>&1
                                if [[ $? = 0 ]];
                                then
                                        echo "$Programname creates the dirctory $BackupLocation"
                                else
                                        echo "$Programname could not able to create the directory $BackupLocation"
                                        return $ERR
                                fi


                        lFlag=1
                        Llcron=l
                else
                        echo "$Programname is executed with -l option without action mtBackup"
                        echo "$Usage"
                        echo "$Programname is terminated"
                        return $ERR
                fi
                ;;
when i run this script through cronjob,then i am getting a directory creation problem.

supoose the directory name which i am giving is--

/home/namish
then my creates a directory called

/home/namish/backup

when i run it through cron then it again creates the directory backup inside backup directory.I can see my script is like that only but i want to modify this,can you please give me some valueable inputs so that this problem can be resolved.

The outcome should be when i run the script through cron it should not create the dir inside the backup di,instaed it should take backup onlyin the dir /home/namish/backup.If you need any moreclarification then please let me know.

Thanks..

Last edited by namishtiwari; 02-05-2008 at 02:04 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 02-05-2008
Registered User
 

Join Date: Aug 2007
Location: Bangalore
Posts: 288
I tried to remove the -p option also,but still the problem exists.give me some suggestions experts.

Thanks
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0