# Artisan Commands and Scheduled Tasks (Crons)

Command list, arguments/options, usage

# Artisan Commands

# Command Line Commands (Artisan)

CFM includes a number of custom Laravel Artisan commands to help automate and manage blocklists, phishing detection, feed ingestion, and other system behaviors.

To view available commands, use the following in your project root:

```
php artisan
```

Below is an overview of the key command groups available in CFM:

<div id="bkmrk-">---

</div>## 🔌 `agents`

<table id="bkmrk-command-description-"><tbody><tr><th>Command</th><th>Description</th></tr><tr><td>`agents:check-notifications`</td><td>Checks the last-seen status of each agent and sends notifications (e.g., Slack) if any are down.</td></tr></tbody></table>

<div id="bkmrk--1">---

</div>## 🗑️ `autodelete`

<table id="bkmrk-command-description--1"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`autodelete:run`</td><td>Runs `AutoDeleteJob` to remove old records (e.g., blocklist entries, logs) based on custom rules.</td></tr></tbody></table>

<div id="bkmrk--2">---

</div>## 🚫 `blocklist`

<table id="bkmrk-command-description--2"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`blocklist:fetch-geodata`</td><td>Bulk fetches GeoIP data for blocklist entries (country, ASN, etc.).</td></tr><tr><td>`blocklist:resolve-geodata`</td><td>Resolves GeoIP data with optional processing limits for batching.</td></tr><tr><td>`blocklist:resolve-ptr`</td><td>Resolves PTR (Reverse DNS) records for IPs in batches. Parallel processing supported.</td></tr></tbody></table>

<div id="bkmrk--3">---

</div>## 🧹 `cache`

<table id="bkmrk-command-description--3"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`cache:clear`</td><td>Clears the Laravel application cache.</td></tr></tbody></table>

<div id="bkmrk--4">---

</div>## 🦠 `clamav`

<table id="bkmrk-command-description--4"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`clamav:generate-signatures`</td><td>Generates ClamAV-compatible signature files from phishing URLs and malware file hashes (MD5, SHA1, SHA256).</td></tr></tbody></table>

<div id="bkmrk--5">---

</div>## ⚙️ `config`

> *This section may include config sync-related commands, depending on future additions.*

<div id="bkmrk--6">---

</div>## 🌐 `data-feeds`

<table id="bkmrk-command-description--5"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`data-feeds:fetch`</td><td>Fetches and processes all active data feeds configured in the system.</td></tr><tr><td>`import:blocklist`</td><td>Imports a list of IPs into the blocklist, whitelist, or greylist.</td></tr><tr><td>`import:domains`</td><td>Imports domains into the blocklist or whitelist.</td></tr><tr><td>`import:mail-filters`</td><td>Imports email sender/domain filters from a file.</td></tr></tbody></table>

<div id="bkmrk--7">---

</div>## 📄 `iplists`

<table id="bkmrk-command-description--6"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`iplists:generate`</td><td>Generates `whitelist.txt`, `greylist.txt`, and `blacklist.txt` files from the database for CSF or DNS use.</td></tr></tbody></table>

<div id="bkmrk--8">---

</div>## 📬 `mailfromfilters`

<table id="bkmrk-command-description--7"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`mailfromfilters:generate`</td><td>Generates `mailfromfilters.cf` used by the mail filtering system, based on DB entries.</td></tr></tbody></table>

<div id="bkmrk--9">---

</div>## 🧠 `spamassassin`

<table id="bkmrk-command-description--8"><tbody><tr><td>Command</td><td>Description</td></tr><tr><td>`spamassassin:generate-rules`</td><td>Generates a SpamAssassin custom keyword rule file from the `spam_keywords` table. Supports strict and loose matching, Greek normalization, etc.</td></tr></tbody></table>

<div id="bkmrk--10">---

</div>These commands allow you to maintain and automate your security infrastructure directly from the console, and can be scheduled or run on-demand as needed.

# Scheduled Tasks / Cron and Supervisor settings

## ⏱️ Scheduled Commands (Cron)

Scheduled tasks are defined in `routes/console.php` and executed using Laravel's `schedule:run` command. They can be run via a cron shell script or with a process manager like **Supervisor**.

### Shell Cron Example:

\#!/bin/bash  
cd "$(dirname "$0")"  
php artisan schedule:run &gt;&gt; /dev/null 2&gt;&amp;1

### Supervisor Setup (Recommended)

**Service file:** `supervisor.service`

\[Unit\]  
Description=Supervisor process control system for UNIX  
After=network.target

\[Service\]  
ExecStart=/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf  
ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown  
ExecReload=/usr/bin/supervisorctl -c /etc/supervisor/supervisord.conf $OPTIONS reload  
Restart=on-failure  
RestartSec=50s

**Program config:** `/etc/supervisor/conf.d/cfm.conf`

\[program:cfm\]  
command=php /home/cfm/artisan queue:work redis --memory=2048 --tries=3 --timeout=600  
user=cfm  
autostart=true  
autorestart=true  
numprocs=2  
redirect\_stderr=true  
stdout\_logfile=/var/log/supervisor/cfm.log

### Scheduled Commands

<table id="bkmrk-command-schedule-des"><tbody><tr><td>Command</td><td>Schedule</td><td>Description</td></tr><tr><td>`iplists:generate`</td><td>Every 10 minutes</td><td>Generate updated IP lists from the DB</td></tr><tr><td>`clamav:generate-signatures`</td><td>Hourly at :50</td><td>Generate ClamAV signature files</td></tr><tr><td>`agents:check-notifications`</td><td>Every minute</td><td>Check agent status and send alerts</td></tr><tr><td>`autodelete:run`</td><td>Daily at 08:00</td><td>Run AutoDelete cleanup job</td></tr><tr><td>`config:sync-storage`</td><td>Every 5 minutes</td><td>Sync configuration files from disk</td></tr><tr><td>`blocklist:resolve-ptr`</td><td>Every 10 minutes</td><td>Resolve PTR records in batches</td></tr><tr><td>`blocklist:resolve-geodata`</td><td>Every 10 minutes</td><td>Resolve ASN/Country data in bulk</td></tr><tr><td>`unblocks:cleanup`</td><td>Every 5 minutes</td><td>Cleanup old unblock requests</td></tr><tr><td>`phishlist:generate`</td><td>Every 30 minutes</td><td>Regenerate phishing domain list</td></tr><tr><td>`mailfromfilters:generate`</td><td>Hourly</td><td>Regenerate mailfromfilters.cf</td></tr><tr><td>`execution:dispatch`</td><td>Every minute</td><td>Dispatch queued execution rules</td></tr><tr><td>`DataFeedJob (callback)`</td><td>Every minute</td><td>Dispatch data feed jobs for active feeds</td></tr></tbody></table>

These scheduled commands are critical for keeping data up-to-date, automating cleanup, syncing feeds and configurations, and dispatching jobs to agents or queues.