Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] How change job's owner



frbn wrote:

> edit the q<jobid> file and change the jobowner field
> and all the relevant fields.


Whipped up a piece of PERL if anyone wants this (or add to contrib, 
whatever):

#!/usr/bin/perl -w
# Copyright 2002, Michael T. Babcock <mbabcock@fibrespeed.net>
# Program redistributable under the LGPL version 2 or later or the 
Artistic license

use strict;

# Change these #
# TODO: Change to use ARGV / getopt
my $HylaDIR = "/var/spool/fax";
my $JID = 27305;
my $NewOwner = "user";
my $NewEmail = "user\@foo.bar";

# No changes necessary after this #
my $JobFile = "$HylaDIR/q$JID";
my $NewJobFile = "$HylaDIR/q$JID.$$-`date +%s`";

open NEWQFILE, "> $NewJobFile" or die("Couldn't create $NewJobFile\n");
open SENDQFILE, "< $JobFile" or die("Can't open/read $JobFile\n");
while(<SENDQFILE>)
{      
        $NewEmail and s/^mailaddr:(\S+)/mailaddr:$NewEmail/
                and print "Changed $1 to $NewEmail\n";
        $NewOwner and s/^sender:(\S+)/sender:$NewOwner/
                and print "Changed $1 to $NewOwner\n";

        print NEWQFILE $_;
}
close (SENDQFILE) or die("Warning: couldn't close job file properly.\n");
close (NEWQFILE) or die("Warning: couldn't close replacement temp file 
properly.\n");

rename ($NewJobFile, $JobFile) or die("Couldn't replace $JobFile with 
$NewJobFile\n");

-- 
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock



____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@hylafax.org.*



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services