[freeside-users] Time of "next bill date"

Gerald V. Livingston II gerald.freeside at sysmatrix.net
Sun Sep 10 14:18:58 PDT 2006


The script below seems to still need some work. When I run it I get:

User 10 not found in mapsecrets! at /usr/local/share/perl/5.8.4/FS/UID.pm
line 260.

But, if I take the output of the echo command and paste that to the command
line it works fine. For some reason it's interpreting the space at "Sun, 10
Sep" as a variable break even though the date is wrapped in dquotes.

Does someone have another suggestion for a time format that is Date::Parse
compatible and a bit less vulnerable to "mistaken space interpretation".
Something with no spaces or commas at all that includes complete date,
time, and timezone would be best. The examples in the Date::Parse docs are
a bit sparse. I'm sure it would be happy with other formats.

Gerald

On Sun, 10 Sep 2006 15:40:31 -0500 (Central Standard Time) "Gerald V.
Livingston II" <gerald.freeside at sysmatrix.net> wrote:

> On Sun, 10 Sep 2006 13:17:24 -0400 Jeremy Davis <jeremy at manageisp.com>
> wrote:
> 
> Gerald wrote:
> 
> > > Now, let's say in October a few accounts have been deleted that would have
> > > fallen earlier in the daily run. So, on 10/10/2006 freeside-daily passes
> > > this account at 09:06:59 -- once again it gets skipped over, not billed
> > > until the following day, and its billing day gets pushed back again, now to
> > > the 11th of each month.
> > >
> > > If the time portion of that field could be defaulted to always be 00:00:01
> > > OR if freeside-daily would simply ignore the time portion of that field
> > > the problem would be solved.
> > >
> > >   
> > Not that this is the perfect solution but you could have freeside-daily 
> > run one day into the future.  Then you can make some adjustments in 
> > invoice events to settle the differences.
> > 
> > Jeremy
> 
> I was looking at building a bash wrapper around the freeside-daily cron
> job. A little 'date', 'cut', and 'sed' can probably get it done.
> 
> Actually, no cut and sed required. Hacked this up while writing this reply
> (just uses echo here in the example as a safe test bed). change "user" to a
> valid username and make sure cron is running the whole this as UID
> freeside. When I set up the self-service server I'll figure out a way to
> block signups between 23:45:00 and 00:00:01 for "system maintenance".
> 
> (extra line breaks below to keep the email wrapping polite)
> 
> #!/bin/bash
> 
> # freeside-daily-today-wrapper
> 
> # Wrapper for freeside-daily billing to ensure all 
> 
> # accounts are billed on the correct anniversary 
> 
> # date regardless of what time freeside-daily is run 
> 
> # by telling it to run as if the current time is very late 
> 
> # in the day so an account with a "Next Billing Date" 
> 
> # of "Sept 09, 2006 22:00:00" will not get skipped 
> 
> # and billied the NEXT day if freeside-daily is run at 
> 
> # "Sept 09, 2006 09:00"
> 
> # Run as-is to make sure your version of 'date' 
> 
> # spits out the correct format. Make sure the "timezone" 
> 
> # variable is getting correctly set. "date" will leave it 
> 
> # blank if t can't determine a timezone.
> 
> # Using echo prevents freeside-daily from actually running.
> 
> # When the output "looks right" edit this file. Remove the "echo". 
> 
> # Change "user" to a valid freeside user login name. Put it in 
> 
> # /usr/local/bin and "chmod 555 freeside-daily-today-wraper"
> 
> # Then set this in your system-wide crontab running as UID 'freeside' 
> 
> # instead of running freeside-daily directly
> 
> today=`date +"%a, %e %b %y "` 
> timezone=`date +"%Z"`
> 
> echo /usr/local/bin/freeside-daily -d \"$today 23:50:00 $timezone\" gerald
> 
> #END




More information about the freeside-users mailing list