WordPress WP Backup Sample Script Rumi, July 26, 2024 #!/bin/bash # your backups will use these filenames. db_backup_name=”tweenpath-db-backup-“`date “+%Y-%m-%d”`”.sql.gz” wpfiles_backup_name=”tweenpath-files-backup-“`date “+%Y-%m-%d”`”.tar.gz” ## 1: database connection info. You can get these details from your wp-config file. db_name=”user_name” db_username=”database” db_password=”password” ## 2: Path to your WordPress Upload and Theme directories. Replace /home/username/ with path to your home directory. wp_upload_folder=”/home/tweenpath/public_html” ## 3:… Continue Reading
MinIO object storage upload using curl Rumi, June 7, 2024 #!/bin/bash # Usage: ./minio-upload my-bucket my-file.zip bucket=$1 file=$2 host=minio.example.com s3_key=svc_example_user s3_secret=svc_example_user_password resource=”/${bucket}/${file}” content_type=”application/octet-stream” date=`date -R` _signature=”PUT\n\n${content_type}\n${date}\n${resource}” signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64` curl -X PUT -T “${file}” \ -H “Host: ${host}” \ -H “Date: ${date}” \ -H “Content-Type: ${content_type}” \ -H “Authorization: AWS ${s3_key}:${signature}” \… Continue Reading
PHPSysinfo CentOS 7 Installer Script Rumi, January 23, 2024 Intended to to deploy on a barebone fresh CentOS installation with Apache and PHP- !#/bin/sh ################################################# # Server Configuration for Centos 6.8 Final # # Don’t use port 7071 # Updated by Rumi- hasan@servermart.net # ################################################# ## updating packages sudo yum update -y ## installing dependencies sudo yum install unzip… Continue Reading
Delete files older than 10 days using shell command Rumi, October 28, 2023 find is the common tool for this kind of task : find ./my_dir -mtime +10 -type f -delete EXPLANATIONS ./my_dir your directory (replace with your own) -mtime +10 older than 10 days -type f only files -delete no surprise. Remove it to test your find filter before executing the whole command Src: https://stackoverflow.com/questions/13489398/delete-files-older-than-10-days-using-shell-script-in-unix Continue Reading
Zimbra Let’s Encrypt auto-renew SSL Rumi, January 26, 2023 Required for this script to work is certbot package installed on email server and sudo rights to add script in crontab. You can add script in crontab at a weekly run like this: 0 0 * * 0 root /path_to_script. #!/bin/bash #Set domain for renew (in format openthreat.ro) DOMAIN=”” certbot… Continue Reading
Zimbra Let’s Encrypt SSL Script Rumi, December 28, 2022 #!/bin/bash -x # SSL certificate installation in Zimbra # with SSL certificate provided by Let’s Encrypt (letsencrypt.org) # Check if running as root if [ “$(id -u)” != “0” ]; then echo “This script must be run as root” 1>&2 exit 1 fi read -p ‘letsencrypt_email [mail@server]: ‘ letsencrypt_email read… Continue Reading
Installer for jitsi-meet, jigasi and jibri Rumi, November 19, 2022 Found this lovely code base (that actually worked) on github, supported on a debian 10/11 or ubuntu 20+ versions- The script (jitsi_setup.sh) can be used to install stable version of all 3 on a stand-alone server. This is simply a script version of quick-install document at https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart It Installs below… Continue Reading
Monitor Service Port if Down execute a Bash Script Rumi, November 14, 2022 #!/bin/bash HOST_NAME=”127.0.0.1″ HOST_PORT=”1656″ if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then echo -e “PORT: ${HOST_PORT} | ON” else cd /home/rumi/my-app/ && `node service.js` fi exit; Continue Reading
Clean RDP Sessions Rumi, June 18, 2022 Just found it useful with the garbage of RDP session to clean- Paste the below lines on a notepad and rename it- rdp_clean.bat. Execute the batch file through cmd line as admin user. @echo off reg delete “HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default” /va /f reg delete “HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers” /f reg add… Continue Reading
Bash Script To Restart Linux Server Services Rumi, December 21, 2021 Here’s the command line code to create the file in nano: sudo nano /opt/launch-crashed-services.sh Here is the bash script. #!/bin/bash service mysql status | grep ‘active (running)’ > /dev/null 2>&1 if [ $? != 0 ] then sudo service mysql restart > /dev/null fi service nginx status | grep ‘active… Continue Reading