https://github.com/murphyadam/bashadministratorscripts
Featured useful administrators bash scripts which handle crucial and time-consuming operations.
https://github.com/murphyadam/bashadministratorscripts
administrators bash bash-script linux
Last synced: about 2 months ago
JSON representation
Featured useful administrators bash scripts which handle crucial and time-consuming operations.
- Host: GitHub
- URL: https://github.com/murphyadam/bashadministratorscripts
- Owner: MurphyAdam
- Created: 2020-09-28T18:51:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-20T17:05:09.000Z (over 5 years ago)
- Last Synced: 2025-03-20T16:57:19.394Z (over 1 year ago)
- Topics: administrators, bash, bash-script, linux
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Administrator Bash Scripts
Featured useful administrators bash scripts which handle crucial and time-consuming operations. Star, fork or contribute if you wish so.
#### Current available scripts
1. central-logger
2. - new scripts will be added frequently
### Examples
##### central-logger
central-logger is a file watcher which detects only the keywords list changes in a file and logs them into a more dedicated destination file.
##### Shell arguments
-f : filename somefile.txt. Required
-k : keyword list to watch for. e.g. 'error|csrf|down'. Required
-o : output file. default output.log
-v 1: verbous mode. default none-verbous
-b 1: run process in background and return shell. default foreground
first time you run the script, make sure it has rwx permissions
```bash
chmod 777 central-logger.sh
```
then whenever you want to watch a file, just do as below.
```bash
bash ./central-logger -f hosts -k 'error|broke|warning|kill' -o vital-logs.log -v 1 -b 1
```
example above watches the file ```hosts``` for any entries defined in the passed keyword_list (-k 'error|broke|warning|kill') and then logs them to the output file ```vital-logs.log```
```bash
cat vital-logs
[2020-09-27T16:35:24+01:00] error [in ../hosts]
[2020-09-27T16:35:24+01:00] broken [in ../hosts]
[2020-09-27T16:35:24+01:00] warning [in ../hosts]
[2020-09-27T16:37:22+01:00] error [in ../hosts]
[2020-09-27T16:37:30+01:00] error [in ../hosts]
```
### GitHub repository
[https://github.com/MurphyAdam/BashAdministratorScripts](https://github.com/MurphyAdam/BashAdministratorScripts