This file contains hidden or 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 | |
SERVER=$1 | |
STATUS=$(curl -sL -o /dev/null -w "%{http_code}" $SERVER) | |
case $STATUS in | |
200) | |
echo "$SERVER is still running." | |
exit 0 | |
;; | |
*) | |
echo "$SERVER is not running." |
This file contains hidden or 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 | |
dur=`ffprobe -v error -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 "$1" | head -n 1` | |
## Chinh so phut o $parts, $t va 2 cau lenh cut | |
flag=`echo "$dur > 3600" | bc` | |
name=`echo $1 | tr '.' ' ' | awk {'print $1'}` | |
if [ $flag = "1" ] | |
then |
This file contains hidden or 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 | |
cat > /etc/yum.repos.d/mariadb.repo << EOF | |
[mariadb] | |
name = MariaDB | |
baseurl = http://yum.mariadb.org/10.3/centos73-amd64/ | |
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB | |
gpgcheck=1 | |
EOF |
This file contains hidden or 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 | |
yum install -y yum-utils device-mapper-persistent-data lvm2 | |
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | |
yum install docker-ce docker-ce-cli containerd.io -y | |
systemctl start docker | |
systemctl enable docker | |
curl -sLk "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose |
This file contains hidden or 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 | |
timedatectl set-timezone Asia/Ho_Chi_Minh | |
yum install ntp -y | |
ntpdate pool.ntp.org |
This file contains hidden or 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 | |
encrypt(){ | |
echo -n "$1" | md5sum | awk {'print $1'} | |
# echo -n "$1" | openssl md5 | awk {'print $2'} | |
} | |
RAW="$1" | |
encrypt $RAW |
This file contains hidden or 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 | |
wget -qP /tmp/ https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz | |
cd /tmp | |
tar -xf /tmp/ffmpeg-release-amd64-static.tar.xz | |
cp -R /tmp/ffmpeg-*/ff* /usr/local/sbin/ | |
rm -rf /tmp/ffmpeg-* | |
curl -sL https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl | |
chmod a+rx /usr/local/bin/youtube-dl |
This file contains hidden or 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 | |
FILE=$1 | |
if [ -e $FILE ] | |
then | |
cat $FILE | while read -r l | |
do | |
text=`echo $l | sed "s/(//g; s/'//g; s/)//; s/;//g; s/)//g; s/,//g"` | |
USER=$(echo $text | awk '{print $1}') |
This file contains hidden or 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
import boto3 | |
from datetime import datetime, timedelta | |
# Requeriment | |
## python2.7, boto3 (pip install boto3) | |
## ~/.aws/credentials - Contain your credentail (API, Secret) | |
## ~/.aws/config - Contain your config (Region,...) | |
## More details: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html | |
# Upload a file into Bucket |
This file contains hidden or 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 | |
BACKUP_DIR="/opt/backup" | |
mkdir -p ${BACKUP_DIR} | |
## Get all databases on system | |
USER="root" | |
PASSWORD="" | |
DBS=`mysql -u ${USER} -p${PASSWORD} -sNe "SHOW DATABASES;" | grep -Ev "information_schema|performance_schema|mysql|test"` | |
for DB in ${DBS} |