Add systemd service/timer files for clearing extracted issues. Update README to reflect updated codebase and service/timer instructions.

This commit is contained in:
Junior 2025-03-13 13:25:52 -04:00
parent a10f3a00eb
commit daae79a166
3 changed files with 30 additions and 3 deletions

View File

@ -1,12 +1,12 @@
# Comics Viewer # Comics Viewer
This small project provides a web based viewer for comics in the CBZ and CBR formats. Bear in mind that much of the code in this project is **very** old and has had lots of "just get it working" updates over the decades (not kidding) to keep up with changing PHP API requirements. It is *sooooo* not pretty (but should be *safe*). This small project provides a web based viewer for comics in the CBZ and CBR formats. Comic archive files are parsed and extracted dynamically while browsing and viewing. Thumbnails are created for both series and issues the first time a folder is accessed.
## This project requires ## This project requires
* PHP ImageMagick * PHP ImageMagick
* PHP RAR (PECL) * PHP RAR (PECL)
- Unfortunately RAR 4.2.0 has not been updated for PHP 8/8.2 (as of 2023-08-18). There is a [fix](https://github.com/cataphract/php-rar/pull/18/commits/02331ca1cc1e8638c34e024566f4b391a6c863c5) available. Just replace the files in the version from PECL/Github with the ones in [this](https://github.com/cataphract/php-rar/pull/18). - Unfortunately RAR 4.2.0 has not been updated for PHP 8/8.2 (as of 2025-03-13). There is a [fix](https://github.com/cataphract/php-rar/pull/18/commits/02331ca1cc1e8638c34e024566f4b391a6c863c5) available. Just replace the files in the version from PECL/Github with the ones in [this](https://github.com/cataphract/php-rar/pull/18).
## Don't forget to: ## Don't forget to:
@ -15,4 +15,17 @@ This small project provides a web based viewer for comics in the CBZ and CBR for
* Import the `install/initial_db_mysql.sql` database structure * Import the `install/initial_db_mysql.sql` database structure
* Change the ownership of the `comics/` and `thumbs/` folders to the web server user * Change the ownership of the `comics/` and `thumbs/` folders to the web server user
* Copy the `variables-dist.php` file to `variables.php` and edit that file appropriately * Copy the `variables-dist.php` file to `variables.php` and edit that file appropriately
* Set up the cron job for things in [cron/](cron/) * Set up the cron job for things in [cron/](cron/). If installing on a systemd OS see services below.
## Services
If installing on an OS that uses systemd there are service and timer files available to run the periodic jobs. They can be installed like so:
* Edit the script path to the appropriate installation location in the service file(s)
* Copy the service/timer files to the system:
- `sudo cp install/clearextracts.* /etc/systemd/system/`
- `sudo systemctl daemon-reload`
* Start the timer:
- `sudo systemctl start clearextracts.timer`
* Enable the timer:
- `sudo systemctl enable clearextracts.timer`

View File

@ -0,0 +1,5 @@
[Unit]
Description="A script to remove extracted comics in webapp older than a set age (defaults to 10 days)"
[Service]
ExecStart=/usr/bin/php /var/www/htdocs/comics/cron/clearExtracts.php

View File

@ -0,0 +1,9 @@
[Unit]
Description="Run ClearExtracts.service at 5am every day"
[Timer]
OnCalendar=*-*-* 05:00:00
Unit=clearextracts.service
[Install]
WantedBy=multi-user.target