The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cleaning core files ghost01 UNIX for Dummies Questions & Answers 5 04-19-2009 07:11 PM
content need changes- many files swchee Shell Programming and Scripting 3 10-05-2006 01:29 PM
cleaning log files rocker40 UNIX for Dummies Questions & Answers 6 10-15-2003 03:19 PM
Compare the content of 2 files odogbolu98 Shell Programming and Scripting 3 09-10-2002 12:44 PM
Cleaning text files ferretman UNIX for Dummies Questions & Answers 5 12-20-2001 09:47 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-14-2006
jyotipg jyotipg is offline
Registered User
  
 

Join Date: Oct 2001
Location: Bangalore
Posts: 95
Cleaning the content of log files

Hi,

I am facing problems while trying to clean a log file(Means making its file Size zero).
I am not the owner of this file. From the command line, I can clean it by becoming a Sudo. (">logfilename").

I want to automate it using perl. But inside a script, sudo somehow doesnt seem to work.

Since I have to do this operation several times in the programs, its inconvenient to the the "Sudo" package provided by Perl as I need to set all the values of the Sudo structure everytime with different parameters.

The Sudo package is like this:

use Sudo;
my $su;

$su = Sudo->new(
{
sudo => '/usr/bin/sudo',
sudo_args => '...',
username => $name,
password => $pass,
program => '/path/to/binary',
program_args => '...'
}
);

$result = $su->sudo_run();

So, setting the atrributes of Sudo object everytime is inconvenient.

Is there any work around for it? I am using a BSD box and using bash as my shell.

Thanks,
Jyoti
  #2 (permalink)  
Old 11-15-2006
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
why not setup the script first and then have that installed in sudo with all the appropriate controls? then you only need to run one script ...


just a thought ...
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0