LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 03:09 AM   #1
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 234

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, 03:14 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 03: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: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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, 03:27 AM   #4
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 234

Original Poster
Rep: Reputation: 18
the directory exist and it has full permission
so i dotn think thats the issue.
 
Old 04-25-2010, 03: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: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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, 03:52 AM   #6
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 234

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

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

Threads can be marked SOLVED via the Thread Tools menu.
 
  


Reply



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 02:38 AM
Looping issue in bash scripting ZAMO Linux - General 4 09-26-2008 11:22 AM
Scripting issue.. szahri Linux - Newbie 3 03-22-2007 02:04 AM
Linux Scripting Issue Kicking my Butt !!! steve_f60 Linux - General 1 04-29-2005 04:00 PM
Scripting issue. dolvmin Linux - Software 8 09-18-2003 10:28 PM

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

All times are GMT -5. The time now is 06:56 AM.

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
Open Source Consulting | Domain Registration