here is my script--
: 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--
then my creates a directory called
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.