https://github.com/formapro/crony
Lightweight cron replacement that calls URL.
https://github.com/formapro/crony
Last synced: 7 months ago
JSON representation
Lightweight cron replacement that calls URL.
- Host: GitHub
- URL: https://github.com/formapro/crony
- Owner: formapro
- Created: 2019-04-06T16:41:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-29T17:31:08.000Z (about 7 years ago)
- Last Synced: 2025-03-01T16:47:31.741Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Crony
Lightweight cron replacement that calls URL
## Usage
Config
```json
{
"tasks": [
{
"cron": "@every 1m",
"url": "http://app/task"
}
]
}
```
Docker
```yaml
services:
app:
cron:
image: 'formapro/crony:latest'
depends_on:
- app
volumes:
- './crony.json:/app/crony.json'
```
Symfony
Route:
```yaml
#config/routes.yaml
cron_task:
path: '/cron/task/foo'
controller: 'App\Controller\CronTaskController::foo'
methods: [POST]
```
Controller:
```php
attributes->set('task', 'foo');
return new Response();
}
public function onTerminate(PostResponseEvent $event): void
{
if ('foo' !== $event->getRequest()->attributes->get('task')) {
return;
}
// do task
}
public static function getSubscribedEvents(): array
{
return [
KernelEvents::TERMINATE => 'onTerminate',
];
}
}
```
## License
MIT