srchproc.py rename to procutil.py
This commit is contained in:
parent
7a136f236f
commit
c754f48718
68
README.md
68
README.md
|
@ -1,12 +1,12 @@
|
|||
# utils
|
||||
|
||||
* [ffmpeger.py](https://git.hmp.today/pavel.muhortov/utils#ffmpeger-py)
|
||||
* [procutil.py](https://git.hmp.today/pavel.muhortov/utils#procutil-py)
|
||||
* [sendmail.py](https://git.hmp.today/pavel.muhortov/utils#sendmail-py)
|
||||
* [srchproc.py](https://git.hmp.today/pavel.muhortov/utils#srchproc-py)
|
||||
____
|
||||
## ffmpeger.py
|
||||
**Description:** FFmpeg management from Python
|
||||
**Dependencies:** Python 3 (tested version 3.9.5), installed or downloaded ffmpeg, [srchproc.py](https://git.hmp.today/pavel.muhortov/utils#srchproc-py) in the same directory
|
||||
**Dependencies:** Python 3 (tested version 3.9.5), installed or downloaded ffmpeg, [procutil.py](https://git.hmp.today/pavel.muhortov/utils#procutil-py) in the same directory
|
||||
|
||||
| PARAMETERS | DESCRIPTION | DEFAULT|
|
||||
|-------------|-------------|--------|
|
||||
|
@ -37,6 +37,38 @@ FFmpeg.run(src='null, anull', preset='240p', fps=10)
|
|||
```
|
||||
|
||||
____
|
||||
## procutil.py
|
||||
**Description:** Find a running process from Python
|
||||
**Dependencies:** Python 3 (tested version 3.9.5)
|
||||
|
||||
| PARAMETERS | DESCRIPTION | DEFAULT|
|
||||
|-------------|-------------|--------|
|
||||
|**[-h]**|print help and exit||
|
||||
|**[--find]**|find process pid, name or arguments||
|
||||
|**[--exclude]**|exclude process pid, name or arguments|`None`|
|
||||
|**[--self]**|find a clones of self|`True`|
|
||||
|**[--kill]**|kill the process with pid||
|
||||
|
||||
Example usage in terminal with Python for find all running processes:
|
||||
```shell
|
||||
python3 ./procutil.py
|
||||
```
|
||||
Example usage in terminal with make the script executable for find all specified processes:
|
||||
```shell
|
||||
chmod u+x ./procutil.py
|
||||
./procutil.py --find ssh --exclude sftp
|
||||
```
|
||||
Example usage in Python for find a clones of self:
|
||||
```Python
|
||||
from os import getpid
|
||||
from sys import argv
|
||||
from procutil import Proc
|
||||
|
||||
processes = Proc.search(' '.join(argv), str(getpid()))
|
||||
if processes:
|
||||
for process in processes:
|
||||
print(process)
|
||||
```
|
||||
## sendmail.py
|
||||
**Description:** Sending email from Python
|
||||
**Dependencies:** Python 3 (tested version 3.9.5)
|
||||
|
@ -75,35 +107,3 @@ print(log)
|
|||
```
|
||||
|
||||
____
|
||||
## srchproc.py
|
||||
**Description:** Find a running process from Python
|
||||
**Dependencies:** Python 3 (tested version 3.9.5)
|
||||
|
||||
| PARAMETERS | DESCRIPTION | DEFAULT|
|
||||
|-------------|-------------|--------|
|
||||
|**[-h]**|print help and exit||
|
||||
|**[--find]**|find process pid, name or arguments||
|
||||
|**[--exclude]**|exclude process pid, name or arguments|`None`|
|
||||
|**[--self]**|find a clones of self|`True`|
|
||||
|**[--kill]**|kill the process with pid||
|
||||
|
||||
Example usage in terminal with Python for find all running processes:
|
||||
```shell
|
||||
python3 ./srchproc.py
|
||||
```
|
||||
Example usage in terminal with make the script executable for find all specified processes:
|
||||
```shell
|
||||
chmod u+x ./sendmail.py
|
||||
./srchproc.py --find ssh --exclude sftp
|
||||
```
|
||||
Example usage in Python for find a clones of self:
|
||||
```Python
|
||||
from os import getpid
|
||||
from sys import argv
|
||||
from srchproc import Proc
|
||||
|
||||
processes = Proc.search(' '.join(argv), str(getpid()))
|
||||
if processes:
|
||||
for process in processes:
|
||||
print(process)
|
||||
```
|
||||
|
|
|
@ -6,7 +6,7 @@ from os import path, environ
|
|||
from subprocess import Popen, PIPE, STDOUT
|
||||
from sys import platform
|
||||
from time import sleep
|
||||
from srchproc import Proc # or copy class Proc from file srchproc.py here for autonomy of this file
|
||||
from procutil import Proc # or copy class Proc from file procutil.py here for autonomy of this file
|
||||
|
||||
|
||||
class FFmpeg:
|
||||
|
@ -177,7 +177,7 @@ if __name__ == "__main__":
|
|||
epilog='Dependencies: '
|
||||
'Python 3 (tested version 3.9.5), '
|
||||
'installed or downloaded ffmpeg, '
|
||||
'srchproc.py in the same directory'
|
||||
'procutil.py in the same directory'
|
||||
)
|
||||
args.add_argument('-s', '--src', type=str, required=True,
|
||||
help='sources urls (example: "rtsp://user:pass@host:554/Streaming/Channels/101, anull")')
|
||||
|
|
Loading…
Reference in New Issue
Block a user