LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-06-2006, 03:47 AM   #1
kinetik
Member
 
Registered: Dec 2005
Location: The most beautiful city in the world.
Distribution: Mostly RedHat. Also Suse, Ubuntu, PHLAK etc.
Posts: 149

Rep: Reputation: 15
>> help


I don't know if this is a real programming issue...


I'm trying to write a script that will cd to a specific directory, then perform an ls -lahS >> logsizes.txt. Then cd to another specific directory and again ls -lahS >> logsizes.txt.


I tried it likke this:

cd /data/specific_directory1/logs/
ls -lahS >> /logchecks/logsizes.txt
cd /data/specific_directory2/logs/
ls -lahS >> /logchecks/logsizes.txt


It's not working though... It keeps saying "cd: /data/specific_directory1/logs/, no such file or directory"


Any advice?
 
Old 01-06-2006, 04:08 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
It's not working though... It keeps saying "cd: /data/specific_directory1/logs/, no such file or directory"

Any advice?
Check if the directory exists, and if you've got 'rx' permissions on it.
 
Old 01-06-2006, 05:12 AM   #3
kinetik
Member
 
Registered: Dec 2005
Location: The most beautiful city in the world.
Distribution: Mostly RedHat. Also Suse, Ubuntu, PHLAK etc.
Posts: 149

Original Poster
Rep: Reputation: 15
The diretories doesn't exist actually (I'm feeling pretty stupid right now!)...

There's still a problem though, and that's that the first directory does exist, with a mountain of data in there, yet this doesn't reflect in the txt file...?
 
Old 01-06-2006, 06:14 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by kinetik
There's still a problem though, and that's that the first directory does exist, with a mountain of data in there, yet this doesn't reflect in the txt file...?
Do you mean the files are not listed in the txt file? Then the user executing your script probably doesn't have read permission on the directory.

<off-topic>
What is "The most beautiful city in the world"?
</off-topic>
 
Old 01-06-2006, 06:38 AM   #5
kinetik
Member
 
Registered: Dec 2005
Location: The most beautiful city in the world.
Distribution: Mostly RedHat. Also Suse, Ubuntu, PHLAK etc.
Posts: 149

Original Poster
Rep: Reputation: 15
<off-topic>
Hko, that's a bit of a sensitive topic. I don't want to reveal where it is since I don't want to step on someone else's toes if it turns out it's not the same city as the one they reside in...
</off-topic>

But back to the problem: The user seems to have all the necessary rights (sudo).

Do you think I should add sudo before all the commands?
 
Old 01-06-2006, 06:44 AM   #6
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
or write permissions to /logchecks/logsizes.txt

<off-topic>
Rabual - or at least it was before the volcano...
</off-topic>
 
Old 01-09-2006, 11:12 AM   #7
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by kinetik
Do you think I should add sudo before all the commands?
If your script needs the rights you granted by /etc/sudoers to access that directory, then yes, I'm sure you need to add "sudo" before the command that runs the script.
 
  


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



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:44 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
Open Source Consulting | Domain Registration