Skip to content

Instantly share code, notes, and snippets.

View yazanmonshed's full-sized avatar
🔝
top

Yazan Monshed ⎈ yazanmonshed

🔝
top
View GitHub Profile
@yazanmonshed
yazanmonshed / display-top-processes.sh
Created January 17, 2023 10:34
Display top processes in system
#!/bin/bash
# Display the top 10 processes by memory usage
ps aux --sort=-%mem | head -n 11
@yazanmonshed
yazanmonshed / check-desk-space-usage.sh
Created January 17, 2023 10:32
Script for check desk space usage
#!/bin/bash
# Set the threshold for disk space usage (in percent)
threshold=90
# Get the current disk space usage
usage=$(df / | awk '{ print $5 }' | tail -n 1 | sed 's/%//')
# Check if the usage is above the threshold
if [ $usage -gt $threshold ]; then
@yazanmonshed
yazanmonshed / check-status-service.sh
Created January 17, 2023 10:27
Check status service using Bash script with Jenkins
#!/bin/bash
# Check the status of the service
# Pass as param from Jenkins Server
service=$1
if systemctl is-active --quiet $service; then
echo "$service is running."
else
echo "$service is not running."
fi
#!/bin/bash
# Notes
# *** need to export GCP Service account insdie the script
# pull data from S3 to local
DIR="/path/to/"
@yazanmonshed
yazanmonshed / remove-docker-logs.sh
Last active October 16, 2022 21:14
Remove Docker Containers Logs
#!/bin/bash
# dir logs files
PATHLOGS=/var/lib/docker/containers/
## This script is only for remove logs for docker containers
## Please make sure to change permission for file such chmod +x remove-docker-logs.sh
# Vlidate path for docker logs
if [ ! -d $PATHLOGS ]; then
#!/bin/bash
#Date Dump Database
#DBDATE=$(date "+%b-%d-%Y-%H-%M-%S")
# call by value variables
DBUSER=$1
DBPASS=$2
DBNAME=$3
#!/bin/bash
# GLOBAL VARABILES
PATHFILES=$1
PATHBACKUPS=$2
FILEBACKUP=$3
JOBNAME=$4
DATE=$(date "+%d-%m-%Y-%H-%M-%S")