mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-21 00:19:42 +02:00
doc update
This commit is contained in:
@ -6,6 +6,7 @@ pydocmd simple jc+ > ../docs/readme.md
|
|||||||
pydocmd simple utils+ > ../docs/utils.md
|
pydocmd simple utils+ > ../docs/utils.md
|
||||||
pydocmd simple jc.parsers.arp+ > ../docs/parsers/arp.md
|
pydocmd simple jc.parsers.arp+ > ../docs/parsers/arp.md
|
||||||
pydocmd simple jc.parsers.crontab+ > ../docs/parsers/crontab.md
|
pydocmd simple jc.parsers.crontab+ > ../docs/parsers/crontab.md
|
||||||
|
pydocmd simple jc.parsers.crontab_u+ > ../docs/parsers/crontab_u.md
|
||||||
pydocmd simple jc.parsers.df+ > ../docs/parsers/df.md
|
pydocmd simple jc.parsers.df+ > ../docs/parsers/df.md
|
||||||
pydocmd simple jc.parsers.dig+ > ../docs/parsers/dig.md
|
pydocmd simple jc.parsers.dig+ > ../docs/parsers/dig.md
|
||||||
pydocmd simple jc.parsers.du+ > ../docs/parsers/du.md
|
pydocmd simple jc.parsers.du+ > ../docs/parsers/du.md
|
||||||
|
199
docs/parsers/crontab_u.md
Normal file
199
docs/parsers/crontab_u.md
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
# jc.parsers.crontab_u
|
||||||
|
jc - JSON CLI output utility crontab file Parser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
specify --crontab-u as the first argument if the piped input is coming from a crontab file with User specified
|
||||||
|
|
||||||
|
Compatibility:
|
||||||
|
|
||||||
|
'linux', 'darwin', 'aix', 'freebsd'
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ cat /etc/crontab | jc --crontab -p
|
||||||
|
{
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "PATH",
|
||||||
|
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SHELL",
|
||||||
|
"value": "/bin/sh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schedule": [
|
||||||
|
{
|
||||||
|
"minute": [
|
||||||
|
"25"
|
||||||
|
],
|
||||||
|
"hour": [
|
||||||
|
"6"
|
||||||
|
],
|
||||||
|
"day_of_month": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"month": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"day_of_week": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"user": "root",
|
||||||
|
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minute": [
|
||||||
|
"47"
|
||||||
|
],
|
||||||
|
"hour": [
|
||||||
|
"6"
|
||||||
|
],
|
||||||
|
"day_of_month": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"month": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"day_of_week": [
|
||||||
|
"7"
|
||||||
|
],
|
||||||
|
"user": "root",
|
||||||
|
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minute": [
|
||||||
|
"52"
|
||||||
|
],
|
||||||
|
"hour": [
|
||||||
|
"6"
|
||||||
|
],
|
||||||
|
"day_of_month": [
|
||||||
|
"1"
|
||||||
|
],
|
||||||
|
"month": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"day_of_week": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"user": "root",
|
||||||
|
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
$ cat /etc/crontab | jc --crontab-u -p -r
|
||||||
|
{
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "PATH",
|
||||||
|
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SHELL",
|
||||||
|
"value": "/bin/sh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schedule": [
|
||||||
|
{
|
||||||
|
"minute": "25",
|
||||||
|
"hour": "6",
|
||||||
|
"day_of_month": "*",
|
||||||
|
"month": "*",
|
||||||
|
"day_of_week": "*",
|
||||||
|
"user": "root",
|
||||||
|
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minute": "47",
|
||||||
|
"hour": "6",
|
||||||
|
"day_of_month": "*",
|
||||||
|
"month": "*",
|
||||||
|
"day_of_week": "7",
|
||||||
|
"user": "root",
|
||||||
|
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minute": "52",
|
||||||
|
"hour": "6",
|
||||||
|
"day_of_month": "1",
|
||||||
|
"month": "*",
|
||||||
|
"day_of_week": "*",
|
||||||
|
"user": "root",
|
||||||
|
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## info
|
||||||
|
```python
|
||||||
|
info(self, /, *args, **kwargs)
|
||||||
|
```
|
||||||
|
|
||||||
|
## process
|
||||||
|
```python
|
||||||
|
process(proc_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
proc_data: (dictionary) raw structured data to process
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
Dictionary. Structured data with the following schema:
|
||||||
|
|
||||||
|
{
|
||||||
|
"variables": [
|
||||||
|
"name": string,
|
||||||
|
"value": string
|
||||||
|
],
|
||||||
|
"schedule": [
|
||||||
|
{
|
||||||
|
"occurrence" string,
|
||||||
|
"minute": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"hour": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"day_of_month": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"month": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"day_of_week": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"occurrence": string,
|
||||||
|
"user": string,
|
||||||
|
"command": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## parse
|
||||||
|
```python
|
||||||
|
parse(data, raw=False, quiet=False)
|
||||||
|
```
|
||||||
|
|
||||||
|
Main text parsing function
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
data: (string) text data to parse
|
||||||
|
raw: (boolean) output preprocessed JSON if True
|
||||||
|
quiet: (boolean) suppress warning messages if True
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
Dictionary. Raw or processed structured data.
|
||||||
|
|
Reference in New Issue
Block a user