¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Automating cleanup of printer output files


 

Hello,

an an actually used (TK4-) system, printer output files tend to get large over time. So I want to truncate them to zero. I'm running 4.3.9999.0-SDL-g9ceed2cc on Linux.

What is the recommended way to do this without stopping and restarting hercules? Usually, a program has to be forced to close and reopen a file, so the actual blocks on disk are freed.

I did some research on the net but found nothing related.

Thanks!

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE -


 

DEVINIT to a new file, delete the old.


On Sun, Jul 19, 2020 at 6:07 AM, Patrik Schindler
<poc@...> wrote:
Hello,

an an actually used (TK4-) system, printer output files tend to get large over time. So I want to truncate them to zero. I'm running 4.3.9999.0-SDL-g9ceed2cc on Linux.

What is the recommended way to do this without stopping and restarting hercules? Usually, a program has to be forced to close and reopen a file, so the actual blocks on disk are freed.

I did some research on the net but found nothing related.

Thanks!

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE -




 

Thank you autocorrect.

DEVINIT to new file, delete the old.


On Sun, Jul 19, 2020 at 7:34 AM, Doug Wegscheid
<dwegscheid@...> wrote:
DEVINIT to a new file, delete the old.


On Sun, Jul 19, 2020 at 6:07 AM, Patrik Schindler
<poc@...> wrote:
Hello,

an an actually used (TK4-) system, printer output files tend to get large over time. So I want to truncate them to zero. I'm running 4.3.9999.0-SDL-g9ceed2cc on Linux.

What is the recommended way to do this without stopping and restarting hercules? Usually, a program has to be forced to close and reopen a file, so the actual blocks on disk are freed.

I did some research on the net but found nothing related.

Thanks!

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE -




 

Hello Doug,

Am 19.07.2020 um 13:34 schrieb Doug Wegscheid <dwegscheid@...>:

DEVINIT to a new file, delete the old.
Thanks!

I think, deleting the old file, and then just doing a devinit should close the file and create a new one.

°Ú¡­±Õ

Yap, works! Thanks!

Now I'll have to see how I can automate this, with cron or other means, from outside. Any hint on that?

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE -


 

On Sun, Jul 19, 2020 at 09:05 AM, Patrik Schindler wrote:
Now I'll have to see how I can automate this, with cron or other means, from outside. Any hint on that?
write a shell script to scratch the file and shoot the devinit command at Hercules via HTTP:? (probably using curl). schedule it in cron.

There is a thread referring to a hercctl utility to allow you to shoot commands at a running Hercules instance, but the link in it is stale, and I can't find it anywhere else.

This worked for me, no way to see what the response is.

curl -d "command=ipl+148" -X POST http://localhost:8081/cgi-bin/tasks/syslog

You may want to consider having it name your printer files yyyymmdd, then you can keep a few days worth around, and clean them up with a find command.

Spitballin' here, but something like:

#!/bin/bash
ymd=`date +"%Y%m%D"`
curl -d "command=devinit+10d+$ymd.txt" -X POST http://localhost:8081/cgi-bin/tasks/syslog


 

Hello Doug,

Am 19.07.2020 um 17:12 schrieb Doug Wegscheid <dwegscheid@...>:

There is a thread here referring to a hercctl utility to allow you to shoot commands at a running Hercules instance, but the link in it is stale, and I can't find it anywhere else.
Thanks for the hint to local http server! I completely forgot about that one. (I found a reference that it's just a shell script, so I don't need that anyway.)

I'll let logrotate do the housekeeping:

[/etc/logrotate.d/hercules-mvs]:
---8<---
/opt/mvsrun/prt/prt002.txt
/opt/mvsrun/prt/prt00e.txt
/opt/mvsrun/prt/prt00f.txt
{
rotate 4
weekly
missingok
notifempty
compress
delaycompress
postrotate
/opt/mvsrun/logrotate-prt.sh
endscript
}
---8<---

[/opt/mvsrun/logrotate-prt.sh]:
---8<---
#!/bin/sh

for DEV in 002 00e 00f; do
curl -d "command=devinit+${DEV}" -X POST
done
---8<---

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE -


 

good thinking.

you could also pipe them to the Apache rotatelogs program, then you don't even need to poke hercules to change files.

On Sunday, July 19, 2020, 1:00:57 PM EDT, Patrik Schindler <poc@...> wrote:


Hello Doug,

Am 19.07.2020 um 17:12 schrieb Doug Wegscheid <dwegscheid@...>:

> There is a thread here referring to a hercctl utility to allow you to shoot commands at a running Hercules instance, but the link in it is stale, and I can't find it anywhere else.

Thanks for the hint to local http server! I completely forgot about that one. (I found a reference that it's just a shell script, so I don't need that anyway.)

I'll let logrotate do the housekeeping:

[/etc/logrotate.d/hercules-mvs]:
---8<---
/opt/mvsrun/prt/prt002.txt
/opt/mvsrun/prt/prt00e.txt
/opt/mvsrun/prt/prt00f.txt
{
? ? ? ? rotate 4
? ? ? ? weekly
? ? ? ? missingok
? ? ? ? notifempty
? ? ? ? compress
? ? ? ? delaycompress
? ? ? ? postrotate
? ? ? ? ? ? ? ? /opt/mvsrun/logrotate-prt.sh
? ? ? ? endscript
}
---8<---

[/opt/mvsrun/logrotate-prt.sh]:
---8<---
#!/bin/sh

for DEV in 002 00e 00f; do
? ? ? ? curl -d "command=devinit+${DEV}" -X POST
done
---8<---

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE -




 

¿ªÔÆÌåÓý

On 7/19/20 3:07 AM, Patrik Schindler wrote:
On an actually used (TK4-) system, printer output files tend to get large over time. So I want to truncate them to zero. I'm running 4.3.9999.0-SDL-g9ceed2cc on Linux.

What is the recommended way to do this without stopping and restarting hercules? Usually, a program has to be forced to close and reopen a file, so the actual blocks on disk are freed.

You may solving the wrong problem.? :-)

This doesn't do your clean up, but may help:

It takes the raw monolithic JES2 output and splits the SYSOUT by JOB/TSU/STC.?? Thus you don't have to purge all or nothing.

Once running this, you might run a command via CRON to kill listings older than N days, for example:

	find /my/print/directory -type f -name '*.txt' -atime +5 -ls -delete 

Note that NO commands need to be issued to Hercules (and you don't wipe out everything at once.)

-ahd-

-- 
Drew Derbyshire

"Never meddle in the affairs of Windows Vista, but it is slow to boot
 and quick to crash."               -- alt.sysadmin.recovery


 

Hello Drew,

Am 20.07.2020 um 04:11 schrieb Drew Derbyshire <swhobbit@...>:

You may solving the wrong problem. :-)
Maybe? At the moment, I mostly care about me not needing to to housekeeping. What are computers actually for, if not for automating boring and repetitive tasks? :-)

It takes the raw monolithic JES2 output and splits the SYSOUT by JOB/TSU/STC. Thus you don't have to purge all or nothing.
Thanks for the hint. Maybe in a later point in time, I'll reconsider my approach, especially when considering printing reports to PDF. First, I want to get accustomed to JCL, to VSAM, and then to COBOL with KICKS4TSO. (I'm already having great fun with my old AS/400 writing small applications for housekeeping with just a few database files.)

Right now, I'm just not doing enough serious stuff with the machine. ATM, I'm just fine with another shell window, 132 chars wide and a tail -f on prt00e running inside.

find /my/print/directory -type f -name '*.txt' -atime +5 -ls -delete
Note that NO commands need to be issued to Hercules (and you don't wipe out everything at once.)
Thanks, I noticed. Just a hint (and not meant as being cocky): I'm using Linux since 1995, and I'm a Linux System Administrator since around 1997. I'm just new to MVS.

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE -


 

On Sun, Jul 19, 2020 at 10:11 PM, Drew Derbyshire wrote:

This doesn't do your clean up, but may help:

It takes the raw monolithic JES2 output and splits the SYSOUT by JOB/TSU/STC.?? Thus you don't have to purge all or nothing.

Drew, thanks for sharing that; I've been meaning to do something like that, but I like yours, and it ended up being simpler than I thought it would. Adapting that for a different naming scheme and to run enscript on the split files should be pretty easy...