26 lines
736 B
Python
26 lines
736 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Cron script: process due recurring transaction rules.
|
|
Run by systemd timer pfm-recurring.timer at 6AM daily.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from app import create_app
|
|
from app.services.recurring_service import process_due_rules
|
|
|
|
app = create_app()
|
|
|
|
if __name__ == '__main__':
|
|
with app.app_context():
|
|
print('[recurring] Processing due rules...')
|
|
created = process_due_rules()
|
|
if created:
|
|
for desc in created:
|
|
print(f' Created: {desc}')
|
|
print(f'[recurring] {len(created)} transaction(s) created.')
|
|
else:
|
|
print('[recurring] No transactions due.')
|