mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-22 07:46:15 -04:00
feat: crontab generator
Signed-off-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
parent
baee5e6656
commit
55dffa5635
6 changed files with 245 additions and 2 deletions
|
@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Next
|
||||||
|
- [feat] [Crontab friendly generator](https://it-tools.tech/crontab-generator)
|
||||||
|
|
||||||
## 1.6.0
|
## 1.6.0
|
||||||
- [feat] [BIP39 generator](https://it-tools.tech/bip39-generator)
|
- [feat] [BIP39 generator](https://it-tools.tech/bip39-generator)
|
||||||
- [feat] [Base 64 converter](https://it-tools.tech/base64-string-converter)
|
- [feat] [Base 64 converter](https://it-tools.tech/base64-string-converter)
|
||||||
|
|
|
@ -20,12 +20,12 @@ Here is an unordered list of the current functionalities, and some that may come
|
||||||
- [x] Git memo (cheat sheet)
|
- [x] Git memo (cheat sheet)
|
||||||
- [x] QR code generator
|
- [x] QR code generator
|
||||||
- [x] Bip39 pass-phrase generator
|
- [x] Bip39 pass-phrase generator
|
||||||
- [ ] Base 64 string converter
|
- [x] Base 64 string converter
|
||||||
|
- [x] Crontab friendly generator
|
||||||
- [ ] CSS memo (cheat sheet)
|
- [ ] CSS memo (cheat sheet)
|
||||||
- [ ] REGEX memo (cheat sheet) + tester?
|
- [ ] REGEX memo (cheat sheet) + tester?
|
||||||
- [ ] Minify/un-minify
|
- [ ] Minify/un-minify
|
||||||
- [ ] Image exif editor/remover
|
- [ ] Image exif editor/remover
|
||||||
- [ ] Crontab friendly generator
|
|
||||||
- [ ] Image format converter?
|
- [ ] Image format converter?
|
||||||
- [ ] Image cropper
|
- [ ] Image cropper
|
||||||
- [ ] Image resizer
|
- [ ] Image resizer
|
||||||
|
|
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -3720,6 +3720,16 @@
|
||||||
"sha.js": "^2.4.8"
|
"sha.js": "^2.4.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"cron-validator": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cron-validator/-/cron-validator-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-vfZb05w/wezuwPZBDvdIBmJp2BvuJExHeyKRa5oBqD2ZDXR61hb3QgPc/3ZhBEQJlAy8Jlnn5XC/JCT3IDqxwg=="
|
||||||
|
},
|
||||||
|
"cronstrue": {
|
||||||
|
"version": "1.96.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-1.96.0.tgz",
|
||||||
|
"integrity": "sha512-kNuuN0AXqspm+jlpwiecFSFBrG5dYBaL5EaW5MEjGAh4IFT/jbKwKCNhzWb8N5NulKQUHEDN7w98GjoAm6PmMg=="
|
||||||
|
},
|
||||||
"cross-spawn": {
|
"cross-spawn": {
|
||||||
"version": "6.0.5",
|
"version": "6.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
"color-convert": "^2.0.1",
|
"color-convert": "^2.0.1",
|
||||||
"color-name": "^1.1.4",
|
"color-name": "^1.1.4",
|
||||||
"core-js": "^3.6.4",
|
"core-js": "^3.6.4",
|
||||||
|
"cron-validator": "^1.1.1",
|
||||||
|
"cronstrue": "^1.96.0",
|
||||||
"dompurify": "^2.0.11",
|
"dompurify": "^2.0.11",
|
||||||
"marked": "^1.1.0",
|
"marked": "^1.1.0",
|
||||||
"qrcode.vue": "^1.7.0",
|
"qrcode.vue": "^1.7.0",
|
||||||
|
|
|
@ -138,6 +138,13 @@ const toolsComponents = [
|
||||||
{
|
{
|
||||||
title: 'Miscellaneous',
|
title: 'Miscellaneous',
|
||||||
child: [
|
child: [
|
||||||
|
{
|
||||||
|
text: 'Crontab generator',
|
||||||
|
path: '/crontab-generator',
|
||||||
|
icon: 'fa-clock',
|
||||||
|
component: () => import('./routes/tools/CrontabGenerator'),
|
||||||
|
keywords: ['Cron', 'Schedule']
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: 'QR Code generator',
|
text: 'QR Code generator',
|
||||||
path: '/qrcode-generator',
|
path: '/qrcode-generator',
|
||||||
|
|
221
src/routes/tools/CrontabGenerator.vue
Normal file
221
src/routes/tools/CrontabGenerator.vue
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
<template>
|
||||||
|
<v-row justify="center" align="center">
|
||||||
|
<v-col cols="12" xl="5" lg="5" md="12">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>Crontab generator</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<div class="result">{{cronString}}</div>
|
||||||
|
<v-text-field
|
||||||
|
ref="cron"
|
||||||
|
class="cron-wrapper"
|
||||||
|
outlined
|
||||||
|
v-model="cron"
|
||||||
|
label="Cron"
|
||||||
|
append-icon="fa-copy"
|
||||||
|
@click:append="copy(cron)"
|
||||||
|
:rules="[isCronValid]"
|
||||||
|
hide-details="auto"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<v-checkbox
|
||||||
|
hide-details
|
||||||
|
label="Verbose"
|
||||||
|
v-model="cronstrueConfig.verbose"
|
||||||
|
/>
|
||||||
|
<v-checkbox
|
||||||
|
hide-details
|
||||||
|
label="Use 24 hour time format"
|
||||||
|
v-model="cronstrueConfig.use24HourTimeFormat"
|
||||||
|
/>
|
||||||
|
<v-checkbox
|
||||||
|
hide-details
|
||||||
|
label="Day of the week start a index 0"
|
||||||
|
v-model="cronstrueConfig.dayOfWeekStartIndexZero"
|
||||||
|
/>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" xl="6" lg="7" md="12">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>Crontab helper</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<div class="text-center">
|
||||||
|
<pre>
|
||||||
|
┌────────── day of week (0 - 6, sunday=0) OR sun,mon ...
|
||||||
|
| ┌──────── month (1 - 12) OR jan,feb,mar,apr ...
|
||||||
|
| | ┌────── day of month (1 - 31)
|
||||||
|
| | | ┌──── hour (0 - 23)
|
||||||
|
| | | | ┌── minute (0 - 59)
|
||||||
|
| | | | |
|
||||||
|
* * * * * command
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<v-simple-table dense>
|
||||||
|
<template v-slot:default>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-left">Symbol</th>
|
||||||
|
<th class="text-left">Meaning</th>
|
||||||
|
<th class="text-left">Example</th>
|
||||||
|
<th class="text-left">Equivalent</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>*</td>
|
||||||
|
<td>Any value</td>
|
||||||
|
<td>
|
||||||
|
<pre>* * * *</pre>
|
||||||
|
</td>
|
||||||
|
<td>Every minute</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>-</td>
|
||||||
|
<td>Range of values</td>
|
||||||
|
<td>
|
||||||
|
<pre>1-10 * * *</pre>
|
||||||
|
</td>
|
||||||
|
<td>Minutes 1 through 10</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>,</td>
|
||||||
|
<td>List of values</td>
|
||||||
|
<td>
|
||||||
|
<pre>1,10 * * *</pre>
|
||||||
|
</td>
|
||||||
|
<td>At minutes 1 and 10</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/</td>
|
||||||
|
<td>Step values</td>
|
||||||
|
<td>
|
||||||
|
<pre>*/10 * * *</pre>
|
||||||
|
</td>
|
||||||
|
<td>Every 10 minutes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@yearly</td>
|
||||||
|
<td>Once every year at midnight of 1 January</td>
|
||||||
|
<td>
|
||||||
|
<pre>@yearly</pre>
|
||||||
|
</td>
|
||||||
|
<td>0 0 1 1 *</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@annually</td>
|
||||||
|
<td>Same as @yearly</td>
|
||||||
|
<td>
|
||||||
|
<pre>@annually</pre>
|
||||||
|
</td>
|
||||||
|
<td>0 0 1 1 *</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@monthly</td>
|
||||||
|
<td>Once a month at midnight on the first day</td>
|
||||||
|
<td>
|
||||||
|
<pre>@monthly</pre>
|
||||||
|
</td>
|
||||||
|
<td>0 0 1 * *</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@weekly</td>
|
||||||
|
<td>Once a week at midnight on Sunday morning</td>
|
||||||
|
<td>
|
||||||
|
<pre>@weekly</pre>
|
||||||
|
</td>
|
||||||
|
<td>0 0 * * 0</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@daily</td>
|
||||||
|
<td>Once a day at midnight</td>
|
||||||
|
<td>
|
||||||
|
<pre>@daily</pre>
|
||||||
|
</td>
|
||||||
|
<td>0 0 * * *</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@midnight</td>
|
||||||
|
<td>Same as @daily</td>
|
||||||
|
<td>
|
||||||
|
<pre>@midnight</pre>
|
||||||
|
</td>
|
||||||
|
<td>0 0 * * *</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@hourly</td>
|
||||||
|
<td>Once an hour at the beginning of the hour</td>
|
||||||
|
<td>
|
||||||
|
<pre>@hourly</pre>
|
||||||
|
</td>
|
||||||
|
<td>0 * * * *</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>@reboot</td>
|
||||||
|
<td>Run at startup</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</template>
|
||||||
|
</v-simple-table>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {copyable} from "../../mixins/copyable.mixin";
|
||||||
|
import cronstrue from 'cronstrue';
|
||||||
|
import * as CronValidator from 'cron-validator'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "CrontabGenerator",
|
||||||
|
mixins: [copyable],
|
||||||
|
data: () => ({
|
||||||
|
cron: '* * * * *',
|
||||||
|
cronstrueConfig: {
|
||||||
|
verbose: true,
|
||||||
|
dayOfWeekStartIndexZero: true,
|
||||||
|
use24HourTimeFormat: true,
|
||||||
|
throwExceptionOnParseError: true
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
methods: {
|
||||||
|
isCronValid(v) {
|
||||||
|
return CronValidator.isValidCron(v, {allowBlankDay: true, alias: true});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
cronString() {
|
||||||
|
if (this.isCronValid(this.cron)) {
|
||||||
|
return cronstrue.toString(this.cron, this.cronstrueConfig)
|
||||||
|
} else {
|
||||||
|
return ' '
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
::v-deep .cron-wrapper input {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 22px;
|
||||||
|
font-family: Consolas, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 18px;
|
||||||
|
margin-bottom: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-center{
|
||||||
|
pre{
|
||||||
|
display: inline-block;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Add table
Add a link
Reference in a new issue