LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > konsolebox
User Name
Password

Notices


Howtos
Old

Example script to run and manage a service (tcpdump) with managed logging.

Posted 10-11-2012 at 07:59 PM by konsolebox
Updated 05-27-2018 at 03:10 PM by konsolebox

I made this script as a reply to a question on a thread before. The accidentally simplified complexity of it amazes me so I thought that it would be nice to post this on a blog as well. Original thread: https://www.linuxquestions.org/quest...cpdump-800385/

The script runs and manages a service (tcpdump). It could also automatically delete files older than C days, and reduce the size of a logfile if it's already larger than N bytes....
Senior Member
Posted in Howtos
Views 9355 Comments 0 konsolebox is offline
Old

libfind - Searches library files with keywords and paths from default values and /etc/ld.so.conf.

Posted 09-17-2012 at 01:03 AM by konsolebox
Updated 05-27-2018 at 03:10 PM by konsolebox
Tags bash, script

I made this utility along with binfind. It also has had lots of improvements since then.

This script can be used to search files contained in library files (*.so, *.la, *.a, etc.) based from keywords provided. Along with a custom list of default paths, it will search for libraries inside directories that are specified in /etc/ld.so.conf. It would also examine files that are specified by the "include" directive in it.

After preparations it would search for...
Senior Member
Posted in Howtos
Views 1790 Comments 0 konsolebox is offline
Old

binfind - Search for executable files based from PATH variable.

Posted 09-04-2012 at 09:51 PM by konsolebox
Updated 05-27-2018 at 03:11 PM by konsolebox
Tags bash, script

I've been using this utility quite long enough already. I use this to search for executable files based from the path values saved in the PATH variable.

Code:
#!/bin/bash

shopt -s extglob

function main {
	# check bash version

	[[ BASH_VERSINFO -ge 3 ]] || {
		echo "This script requires bash version 3.0 or newer."
		return 1
	}

	# check arguments

	[[ $# -eq 0 || "$1"
...
Senior Member
Posted in Howtos
Views 1656 Comments 0 konsolebox is offline
Old

uuidfstab - Convert fstab contents to a format that uses UUID instead of /dev paths.

Posted 09-04-2012 at 09:09 PM by konsolebox
Updated 05-27-2018 at 03:10 PM by konsolebox
Tags bash, fstab, script, uuid

This script helps a user or admin to automatically convert items in fstab so that they would use UUIDs instead.

uuidfstab[.sh]
Code:
#!/bin/bash

function error {
	echo "$1" >&2
	exit 1
}

function show_usage_and_exit {
	error "Usage: $0 <path_to_fstab_file> [<new_fstab_file>]"
}

function process {
	local FSTABFILE=$1 NEWFSTABFILE=$2 LINE DEVICE TEMPFILE
...
Senior Member
Posted in Howtos
Views 2105 Comments 0 konsolebox is offline
Old

Bash functions to list and kill or send signals to process trees

Posted 03-31-2012 at 11:54 PM by konsolebox
Updated 05-27-2018 at 03:11 PM by konsolebox

These functions can be used in scripts or interactive shells to manipulate process trees. At least bash version 3.0 is needed. May also work with some earlier versions.

kill_tree - Creates a list of processes based from a parent process ID first then sends the signal to all of them synchronously.

kill_tree_2 - Same as killtree but it doesn't create a list first. It immediately kills processes as it goes through every level.

kill_tree_3 - This version...
Senior Member
Posted in Howtos
Views 4292 Comments 0 konsolebox is offline

  



All times are GMT -5. The time now is 11:35 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration