Configuring Alerts & Backups
Starting from Snipe-IT v3.0, all automated tasks are handled via the scheduler. To set a cron job to run every minute to ping the scheduler:
* * * * * /path/to/php /path/to/artisan schedule:run >> /dev/null 2>&1
The scheduler already knows how often it should trigger the individual tasks, because of this code in the Console Kernel:
$schedule->command('snipeit:expiring-alerts')->daily(); $schedule->command('snipeit:inventory-alerts')->daily(); $schedule->command('snipeit:backup')->weekly(); $schedule->command('backup:clean')->daily(); $schedule->command('snipeit:expected-checkin')->daily(); $schedule->command('snipeit:upcoming-audits')->daily(); $schedule->command('auth:clear-resets')->everyFifteenMinutes();
So basically, the scheduler will figure out whether or not it needs to trigger any of these tasks, so that you only need to set one cron job task instead of multiple tasks.
You can specify the level of inventory and time range that should start to trigger alerts in Admin > General Settings.
Bypassing the Scheduler
To set up cron jobs separately for expiring asset/license alerts for whatever reason (maybe you want to run your tasks more or less often than the scheduler expects to run tasks), you can still invoke the tasks individually.
If you wish to be reminded via email when your assets are about to reach EOL, or when your licenses are expiring, make sure you have an alert email address listed in
Admin > Settings.
To set up the cron to run every day, set up your crontab as:
@daily /path/to/php /path/to/your/snipe-it/artisan snipeit:expiring-alerts
To set it to run every week, use:
@weekly /path/to/php /path/to/your/snipe-it/artisan snipeit:expiring-alerts
Or to set your backups to daily instead of weekly:
@daily /path/to/php /path/to/your/snipe-it/artisan snipeit:backup
Running Commands Directly
While there's not normally much reason to invoke the alerts commands manually, if you need to do so (for example from another script, or for testing purposes), run them via the command line from your Snipe-IT project root like this:
/path/to/php artisan snipeit:backup /path/to/php artisan backup:clean /path/to/php artisan snipeit:expiring-alerts /path/to/php artisan snipeit:inventory-alerts /path/to/php artisan snipeit:expected-checkin /path/to/php artisan snipeit:user-inventory /path/to/php artisan snipeit:upcoming-audits /path/to/php artisan auth:clear-resets
Updated 9 months ago