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 | |
## upgrade Jenkins steps | |
# Stop running Jenkins service | |
systemctl stop jenkins.service | |
# Take Jenkins instance Backup as a recovery option |
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 | |
if [ -z "$1" ]; then | |
echo "Error: Please provide a value." | |
exit 1 | |
fi | |
sed -i "s/OLD_VALUE.*/NEW_VALUE='$1'/" /path_the_files/file_name.yml | |
echo "NEW_VALUE updated to '$1' in file_name.yml file." |
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
servers_ips=`aws ec2 describe-instances --region us-east-1 --filters "Name=tag-value,Values=TAG_NAME" "Name=instance-state-name,Values=running" --query 'Reservations[].Instances[].[PrivateIpAddress]' --output text | xargs` | |
echo $cs_server | |
# Pass by IP's to tmux-cssh script | |
./tmux-cssh $cs_serve |
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 {} \; |
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 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 | |
# 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 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 | |
# 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 | |
# Notes | |
# *** need to export GCP Service account insdie the script | |
# pull data from S3 to local | |
DIR="/path/to/" |
NewerOlder