LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Script Issue (http://www.linuxquestions.org/questions/linux-general-1/script-issue-72134/)

gauge73 07-12-2003 10:42 AM

Script Issue
 
I've got a backup script that I am running occassionally that I wrote. When I run said script in SSH, it works like a charm. If I run said script in GNOME on the RH8.0 Linux box itself, or through VNC (remote desktop), it will halt the computer pretty much entirely, and I have to reboot. Any suggestions as to why it would work one way and not another? Here is the script:

umask 077
rm -rvf /mnt/backup/*
cp -rdv --no-preserve=ownership /mnt/network/* /mnt/backup/
mkdir /mnt/backup/server
#mkdir /mnt/backup/server/nwn
mkdir /mnt/backup/server/conf
#cp /dservs/nwn/nwnplayer.ini /mnt/backup/server/nwn
#cp -rdv /dservs/nwn/servervault /mnt/backup/server/nwn
#cp -rdv /dservs/nwn/saves /mnt/backup/server/nwn
cp -rdv /etc/samba/smb.conf /mnt/backup/server/conf
cp -rdv /etc/dhcpd.conf /mnt/backup/server/conf
#chown -R root:root /mnt/backup/*
#chmod -R 700 /mnt/backup/*

david_ross 07-12-2003 10:55 AM

At what point does it hang? try putting some echo stements between the commands so you can see how far it gets.

What are you running it from xterm? Maybe try a different terminal.

gauge73 07-12-2003 11:16 AM

You're talking a bit over my head. I'm running ot from the "Terminal Command Line" in GNOME. It seems to hange on the first command. Gets a little ways through the rm command and then dies. I have it running in verbose mode, so I can see what's going on to some extent. What should I do with echo statements? And it *does* run in SSH, for some reason.

david_ross 07-12-2003 01:27 PM

By "Terminal Command Line" I assume you mean the program called gnome-terminal. I was suggesting using xterm or similar as opposed to gnome-terminal to see if it would work.

I mean setting echo statements like:
echo Setting umask
umask 077
echo Removing old backup
rm -rvf /mnt/backup/*
echo Performaing 1st copy opperation
cp -rdv --no-preserve=ownership /mnt/network/* /mnt/backup/

If it hangs after displaying the first 2 messages then you know that it has hung during the "rm" stage.

david_ross 07-12-2003 01:28 PM

Are you running is as the same user in ssh and gnome-terminal?

gauge73 07-13-2003 12:00 AM

Yessir, same user both ways. I don't think the echo statements are necessary since I'm running the rm and cp commands in verbose mode (displayes every copy or deletion). It seems to crash in mid-rm. Any ideas why different shells would react differently?

david_ross 07-13-2003 08:47 AM

No but I just thought it may be worth a try.

Flibble 07-13-2003 01:04 PM

What user are you running this as, is it the same in both cases?

What happens if you run:
chown -R user:group #obviously replace these with the actuals.
chmod -R 700
Before you start mucking with the files?

Flibble

gauge73 07-14-2003 08:50 AM

I don't want to change the owners of all the files before I copy them. That would cause all kinds of problems. When I run this script, I always do so root. It works in SSH and not GNOME. I'm assuming that means it's not a permissions problem?

Plus, the way it crashes is strange. It's a copy from an internal HDD to an external USB HDD. When it crashes (or just slows down to an unbelievable crawl, I think), the internal HDD (the one beind copied from) is running continuously, and the USB HDD is doing nothing.


All times are GMT -5. The time now is 03:16 AM.