Skip to content

Instantly share code, notes, and snippets.

@jaapmarcus
jaapmarcus / rename-bulk.sh
Last active June 18, 2021 07:53
Rename user package on bulk
#!/bin/bash
old_name="default"
new_name="new_package"
# Update package for existing users
for user in `ls /usr/local/hestia/data/users/`; do
OLD_PACKAGE=$(/usr/local/hestia/bin/v-get-user-value $user PACKAGE)
if [ "$old_name" = "$OLD_PACKAGE" ]; then
/usr/local/hestia/bin/v-change-user-package $user $new_name
fi
@plutocrat
plutocrat / dovecot_summary.sh
Last active September 14, 2021 06:22
Grabbing a few key stats from dovecot logs to replace the regular logwatch report
#!/bin/bash
# Future version might store stats in a flatfile DB and then show comparative values, eg +5%, -250%
TEMPFILE=/tmp/dc_temp.log
# Need to cat the last two logs to guarantee 24 hours of data: adjust according to your setup
# zcat -f will deal with uncompressed and gzipped alike
zcat -f /var/log/dovecot.log.1 /var/log/dovecot.log > $TEMPFILE
# Find start hour 24 hours ago. If no match, try 25 hours, 26 hours, etc up to 48 hours
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active April 30, 2025 05:20
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@plutocrat
plutocrat / upload_clean.sh
Last active April 8, 2019 07:02
Wordpress Uploads Directory Cleanout
#!/bin/bash
# wget https://gist.githubusercontent.com/plutocrat/7636841e480f483a97c0d17568ac0ef1/raw/upload_clean.sh
# Dumps your database out, extracts image paths from it and compares it against a list of files from the filesystem
# Needs wp-cli to dump the database.
# Only works on Linuxy servers
# It will give you a chance to bail before it deletes anything.
# If it saves you a few hours, show your appreciation with bitcoin: 35Ws8qgKUCiVaca7vg5NWqkfQozPfzb4my
# Working Dir
WKDIR=zz_temp
@yorch
yorch / ispconfig-migration.sh
Created March 7, 2014 12:39
ISPConfig 3 script to move installation from one server to another
#!/bin/bash
# Migrate ISPConfig 3 installation from one server to another
# This script should run on the final/destination ISPConfig 3 server
# You must first install the same ISPConfig on the destination server
# and make sure to create all the users from the previous installation
# (ISPConfig creates users for each client and web page)
# Tested on ISPConfig version 3.0.5.3
# Created by Jorge Barnaby (@jbarnaby) - March 2014
# EDIT YOUR PREVIOUS ISPCONFIG SERVER HERE
@jasny
jasny / mysql_splitdump.sh
Last active February 27, 2025 17:45
Split MySQL dump SQL file into one file per table or extract a single table
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
exit