This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GLOBAL VARABILES | |
PATHFILES=$1 | |
PATHBACKUPS=$2 | |
FILEBACKUP=$3 | |
JOBNAME=$4 | |
DATE=$(date "+%d-%m-%Y-%H-%M-%S") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Date Dump Database | |
#DBDATE=$(date "+%b-%d-%Y-%H-%M-%S") | |
# call by value variables | |
DBUSER=$1 | |
DBPASS=$2 | |
DBNAME=$3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Notes | |
# *** need to export GCP Service account insdie the script | |
# pull data from S3 to local | |
DIR="/path/to/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Display the top 10 processes by memory usage | |
ps aux --sort=-%mem | head -n 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the server address and port number, Ex (Pass by Jenkins as a parameter’s) | |
server=$1 | |
port=$2 | |
# Check if the port is open | |
nc -v -z $server $port | |
if [ $? -eq 0 ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pass the package name | |
package=$1 | |
# Check if the package is installed on system () | |
if dpkg -s $package > /dev/null 2>&1; then | |
echo "$package is installed." | |
else | |
echo "$package is not installed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the path to the Laravel logs directory | |
LOG_DIR=/path/to/laravel/logs | |
# Set the number of days to keep log files | |
DAYS_TO_KEEP=7 | |
# Find all Laravel log files older than $DAYS_TO_KEEP days and delete them | |
find "$LOG_DIR" -name "*.log" -type f -mtime +$DAYS_TO_KEEP -exec rm {} \; |
OlderNewer