LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scripting issue (https://www.linuxquestions.org/questions/linux-newbie-8/scripting-issue-804042/)

fernfrancis 04-25-2010 03:09 AM

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

Tinkster 04-25-2010 03:14 AM

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



Cheers,
Tink

EricTRA 04-25-2010 03:15 AM

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!

fernfrancis 04-25-2010 03:27 AM

the directory exist and it has full permission
so i dotn think thats the issue.

EricTRA 04-25-2010 03:30 AM

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

fernfrancis 04-25-2010 03:52 AM

thanx a lot problem solved

catkin 04-25-2010 06:21 AM

It may help somebody with a similar problem if you shared the solution.

Threads can be marked SOLVED via the Thread Tools menu.


All times are GMT -5. The time now is 11:54 AM.