LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2010, 04:09 AM   #1
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 229

Rep: Reputation: 18
scripting issue


Hi i have written this simple script

#!/bin/bash
cd /var/log/squid
destination=/media/backup/store
YMD="`date +%d%b%y`"

for file in s*.gz
do
echo $file
echo -e "renamed file $file to $file$YMD " >> ~/squid_script/log
mv $file $destination/$file$YMD
echo -e "file $file$YMD transfered to /media/backup/store/ \n" >> ~/squid_script/log
done
echo "------------------------------------------------" >> ~/squid_script/log


when i execute it i get the following error
cannot move `store.log.1.gz' to `/media/backup/store/store.log.1.gz25Apr10': No such file or directory

can someone rectify this problem for me
 
Old 04-25-2010, 04:14 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
My first guess is that /media/backup either isn't mounted, or
that the directory /media/backup/store doesn't exist.



Cheers,
Tink
 
Old 04-25-2010, 04:15 AM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

Did you create the directory /media/backup/store/ and has the user as who you run the script have permissions on it?

Kind regards,

Eric

EDIT: Tinkster beat me to it!
 
Old 04-25-2010, 04:27 AM   #4
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 229

Original Poster
Rep: Reputation: 18
the directory exist and it has full permission
so i dotn think thats the issue.
 
Old 04-25-2010, 04:30 AM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

You could set the following in your script before the executing commands:
Code:
set -x
That would show you a lot more at runtime.

Kind regards,

Eric
 
Old 04-25-2010, 04:52 AM   #6
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 229

Original Poster
Rep: Reputation: 18
thanx a lot problem solved
 
Old 04-25-2010, 07:21 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
It may help somebody with a similar problem if you shared the solution.

Threads can be marked SOLVED via the Thread Tools menu.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash scripting issue thesav Programming 7 06-20-2009 03:38 AM
Looping issue in bash scripting ZAMO Linux - General 4 09-26-2008 12:22 PM
Scripting issue.. szahri Linux - Newbie 3 03-22-2007 03:04 AM
Linux Scripting Issue Kicking my Butt !!! steve_f60 Linux - General 1 04-29-2005 05:00 PM
Scripting issue. dolvmin Linux - Software 8 09-18-2003 11:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration