https://github.com/grohiro/php-crontab
php-crontab manipulates crontab via PHP
https://github.com/grohiro/php-crontab
Last synced: about 1 month ago
JSON representation
php-crontab manipulates crontab via PHP
- Host: GitHub
- URL: https://github.com/grohiro/php-crontab
- Owner: grohiro
- Created: 2017-08-25T08:56:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-04T05:59:17.000Z (almost 9 years ago)
- Last Synced: 2025-02-24T01:48:25.800Z (over 1 year ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# php-crontab
php-crontab manipulates crontab entry via PHP. You can use this library to add and update, save crontab entries.
## Install
### Composer
composer.json
```json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/grohiro/php-crontab"
}
],
"require": {
"grohiro/php-crontab": "~1.0"
}
}
```
## Usage
```php
use Grohiro\Crontab\Crontab;
$crontab = new Crontab();
// Read crontab
$crontab->init(Crontab::l());
// Add entries
$crontab->addNewEntry('ID1', '0 4 * * * ls -l /var/log');
$crontab->addNewEntry('ID2', '0 5 * * * ls -l /var/spool/mail');
// Change schedule
$crontab->updateEntry('ID1', '30 4 * * * ls -l /var/log');
// Export crontab
$crontab->save();
```
crontab
```
30 4 * * * ls -l /var/log #phpcrontab:ID1
0 5 * * * ls -l /var/spool/mail #phpcrontab:ID2
```