默认情况下,我得到的输出文件名是这样的stdin___L-job_177.pdf
。我想将它们更改为带有时间戳的其他名称。我使用 CUPS 1.2
其结果如下lpoptions
:
/home/informix/PDF/stdntrns_informix_legacysparc_2024-05-02_21-42-48.pdf=true \
copies=1 device-uri=cups-pdf:/ \
finishings=3 \
job-cancel-after=10800 job-hold-until=no-hold job-priority=50 \
job-sheets=none,none marker-change-time=0 number-up=1 \
OutputFile=/home/informix/PDF \
OutputScript=/etc/cups/generate_pdf_filename.sh \
page-bottom=36 page-left=36 page-right=36 page-top=36 \
PDF=true pdftops-renderer=pdftocairo print-color-mode=color \
printer-commands=AutoConfigure,Clean,PrintSelfTestPage printer-info=PDF \
printer-is-accepting-jobs=true printer-is-shared=false \
printer-is-temporary=false printer-location \
printer-make-and-model='Generic CUPS-PDF Printer (w/ options)' \
printer-state=3 printer-state-change-time=1714603473 printer-state-reasons=none \
printer-type=10678348 printer-uri-supported=ipp://localhost/printers/PDF
我的脚本:
informix@legacysparc:/etc/cups$ cat generate_pdf_filename.sh
#!/bin/bash
# /etc/cups/generate_pdf_filename.sh
# Get current user login
USER=$(whoami)
# Get hostname
HOSTNAME=$(hostname)
# Generate timestamp
TIMESTAMP=$(date +'%Y-%m-%d_%H-%M-%S')
# Construct filename
FILENAME="${HOME}/PDF/ztdntrns_${USER}_${HOSTNAME}_${TIMESTAMP}.pdf"
echo "$FILENAME"
当我运行脚本时:
informix@legacysparc:/etc/cups$ ./generate_pdf_filename.sh
/home/informix/PDF/stdntrns_informix_legacysparc_2024-05-02_22-08-42.pdf