[news.software.b] Expire doesn't allow 1-day expirations?

karl@triceratops.cis.ohio-state.edu (Karl Kleinpaste) (03/11/88)

Configuration is Pyramid 98x, heavily patched OSx 4.0, news 2.11
patchlevel 12.

We are having trouble with our news filesystem getting blown out.
It's much too small (we're waiting for new discs to show up), but we
need to try to cope with it as it is.  So I tried setting up the talk
groups to expire in 1 day with
	expire -e1 -E14 -n talk
but I found this morning when my news filesystem blew out again
(sigh...) that there are articles in the talk.* newsgroups which are
as old as the day I made the above change, that is, once I set up
1-day expiration, nothing in talk.* ever expired.

For the time being, I decided to take a simplistic approach, and I now
`expire' talk.* with
	find /usr/spool/news/talk -mtime +0 -type f -exec rm {} ';'
which has the appropriate effect, but I'd rather be doing it The Right
Way.  Does anyone know if this problem has shown up elsewhere before?

By the way, you might be on the lookout for articles in talk.bizarre
with Expires: headers in them...

--Karl

hokey@plus5.UUCP (Hokey) (03/12/88)

Aside from the -[iIp] options to expire which might also be of help,
I added this patch to expire a while ago.  It lets you specify the expiration
time as [days][:hours] .

*** expire.c-	Fri Oct 31 02:56:41 1986
--- expire.c+	Thu Nov 13 02:26:01 1986
***************
*** 153,158
  				setbuf(stdout, (char *)NULL);
  			break;
  		case 'e':	/* Use this as default expiration time */
  			if (argc > 2 && argv[2][0] != '-') {
  				argv++;
  				argc--;

--- 153,163 -----
  				setbuf(stdout, (char *)NULL);
  			break;
  		case 'e':	/* Use this as default expiration time */
+ 		{
+ 			char *exparg;
+ 			long expdays = 0L;
+ 			long exphours = 0L;
+ 
  			if (argc > 2 && argv[2][0] != '-') {
  				argv++;
  				argc--;
***************
*** 156,164
  			if (argc > 2 && argv[2][0] != '-') {
  				argv++;
  				argc--;
! 				expincr = atol(argv[1]) * DAYS;
! 			} else if (isdigit(argv[1][2]))
! 				expincr = atol(&argv[1][2]) * DAYS;
  			break;
  		case 'E':	/* Use this as default forget time */
  			if (argc > 2 && argv[2][0] != '-') {

--- 161,176 -----
  			if (argc > 2 && argv[2][0] != '-') {
  				argv++;
  				argc--;
! 				exparg = argv[1];
! 			} else
! 				exparg = &argv[1][2];
! 			while(isascii(*exparg) && isdigit(*exparg)) {
! 				expdays = expdays * 10L + (long)(*exparg++ - '0');}
! 			if(*exparg == ':') {
! 				++exparg;
! 				while(isascii(*exparg) && isdigit(*exparg)) {
! 					exphours = exphours * 10L + (long)(*exparg++ - '0');}}
! 			expincr = (expdays * DAYS) + (exphours * 60L * 60L);
  			break;
  		}
  		case 'E':	/* Use this as default forget time */
***************
*** 160,165
  			} else if (isdigit(argv[1][2]))
  				expincr = atol(&argv[1][2]) * DAYS;
  			break;
  		case 'E':	/* Use this as default forget time */
  			if (argc > 2 && argv[2][0] != '-') {
  				argv++;

--- 172,178 -----
  					exphours = exphours * 10L + (long)(*exparg++ - '0');}}
  			expincr = (expdays * DAYS) + (exphours * 60L * 60L);
  			break;
+ 		}
  		case 'E':	/* Use this as default forget time */
  			if (argc > 2 && argv[2][0] != '-') {
  				argv++;
-- 
Hokey

henry@utzoo.uucp (Henry Spencer) (03/13/88)

> I added this patch to expire a while ago.  It lets you specify the expiration
> time as [days][:hours] .

An alternate, arguably simpler, way to get the same effect is to convert
number of days to seconds not by doing

	atol(...) * DAYS

but

	(time_t)(atof(...) * DAYS)

so that decimal fractions can be used.  This is what C news expire does.
-- 
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry

davidsen@steinmetz.steinmetz.UUCP (William E. Davidsen Jr) (03/15/88)

| [...]
| For the time being, I decided to take a simplistic approach, and I now
| `expire' talk.* with
| 	find /usr/spool/news/talk -mtime +0 -type f -exec rm {} ';'
| which has the appropriate effect, but I'd rather be doing it The Right
| Way.  Does anyone know if this problem has shown up elsewhere before?

  The way you are doing it will definitely tide you over, but I would
suggest that you use xargs (there's a PD version for BSD) to avoid
starting rm so many times.

  You can also do some useful things with setting limits on the number
of articles in a directory, or k in a directory using a shell script.
Use 'wc' or 'du' as appropriate. This gives longer retention for times
when news is light, and saves your filesystem when its heavy.

  Hopefully Cnews will solve all this, and allow things like "space used
by group" or some such.
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me