From d55a83664e4950e52d04140284d755487e1bdb91 Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Mon, 26 May 2003 19:35:04 +0000 Subject: [PATCH] add NICe keyword --- trunk/ripnews/README | 7 +++++-- trunk/ripnews/TODO | 5 ++++- trunk/ripnews/ripnews.rb | 10 +++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/trunk/ripnews/README b/trunk/ripnews/README index 0f559d4..c5d56d0 100644 --- a/trunk/ripnews/README +++ b/trunk/ripnews/README @@ -1,4 +1,4 @@ -# $Dwarf: README,v 1.8 2003/04/28 14:36:19 ward Exp $ +# $Dwarf: README,v 1.9 2003/05/24 12:09:18 ward Exp $ # $Source$ Ripnews is a bulk downloader for usenet. It's quite flexible in terms of @@ -24,7 +24,7 @@ NNTPSERVER=localhost CACHEDIR=/mnt/newspace/News/.ripnews_caches # PID lockfile, prevents multiple ripnews processes from running at the -# same time +# same time [global keyword] LOCKFILE=/local/newspace/News/.ripnewslock # Set the datadir, this where a subdir for each group will be made to @@ -44,6 +44,9 @@ NEWSRCNAME=/ward/src/ruby/ripnews/.newsrc # Set the permission to create subdirs with PERMISSION=0700 +# Set the niceness of the ripnews process [global keyword] +NICE=20 + # For alt.binaries.e-book.technical change from defaults... alt.binaries.e-book.technical { # Set another include pattern diff --git a/trunk/ripnews/TODO b/trunk/ripnews/TODO index a0366e2..7541e50 100644 --- a/trunk/ripnews/TODO +++ b/trunk/ripnews/TODO @@ -1,9 +1,11 @@ -# $Dwarf: TODO,v 1.14 2003/04/27 22:28:59 ward Exp $ +# $Dwarf: TODO,v 1.15 2003/04/28 14:36:19 ward Exp $ # $Source$ [ ] check for multiple servers (ip adresses) for each name and pick one that works [ ] support mime encoding +[ ] support base64 +[ ] support quotedprintable [ ] documentation [ ] code cleanup [ ] finish intspan @@ -18,3 +20,4 @@ exceptions. Use buffering for each body, before writing... [ ] more regression tests [ ] update documentation +[ ] locking so you won't run 2 ripnews processes at the same time diff --git a/trunk/ripnews/ripnews.rb b/trunk/ripnews/ripnews.rb index e991eda..bac1977 100755 --- a/trunk/ripnews/ripnews.rb +++ b/trunk/ripnews/ripnews.rb @@ -1,6 +1,6 @@ #!/usr/local/bin/ruby -w -# $Dwarf: ripnews.rb,v 1.60 2003/05/24 12:05:57 ward Exp $ +# $Dwarf: ripnews.rb,v 1.61 2003/05/24 18:33:46 ward Exp $ # $Source$ require 'date' @@ -256,6 +256,13 @@ def unlock File.unlink(@config[group]["LOCKFILE"]) end +def renice + group = @config.keys[0] + if @config[group].has_key?("NICE") + Process.setpriority(Process::PRIO_PROCESS, 0, @config[group]["NICE"].to_i) + end +end + def get_single(subj, group) print "Fetching singlepart article: #{subj}\n" body = @articles.get_group_body(subj) @@ -418,6 +425,7 @@ defaults = parse_options(defaults) parse_config(defaults) check_config lock +renice @maxfilelength = get_max_file_length(@config[@config.keys[0]]["TEMPDIR"])