Skip to content

Instantly share code, notes, and snippets.

@shanerutter
shanerutter / simple-wordpress-dev-site-duplicator.sh
Last active March 18, 2023 18:48
Simple script to duplicate a home dir and website db for WordPress website.
#!/bin/sh
echo "Removing Files";
rm -rf /home/dev.domain.com/public_html/*
echo "Copying Files";
cp -rT /home/domain.com/public_html /home/dev.domain.com/public_html
echo "Ownership";
chown -R dev.domain.com:dev.domain.com /home/dev.domain.com/public_html/
@shanerutter
shanerutter / rsync-move-homedir.sh
Created March 18, 2023 18:24
Move the home dir with all owners, groups and permissions intact
rsync --progress --group --owner --recursive --perms --times /mnt/volume_lon1_01/* /home/
#!/bin/sh
doms=`virtualmin list-domains --name-only`
for dom in $doms; do
virtualmin modify-domain --domain $dom --disable-jail;
done
@shanerutter
shanerutter / cpanel move document root
Created March 4, 2023 22:07
cpanel move document root
'/var/cpanel/userdata/USERNAME/DOMAIN.COM'
documentroot: /home/USERNAME/public_html
/scripts/updateuserdomains
/scripts/updateuserdatacache
mv /etc/apache2/conf/httpd.conf{,.bk}
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd
@shanerutter
shanerutter / cpanel_redis_account_remove.sh
Created October 20, 2022 09:51
WHM/cPanel redis per account
#!/bin/bash
# Ask for cpanel name
echo Enter cpanel account name:
read accountname
service redis-${accountname} stop
systemctl disable redis-${accountname}
rm -rf /home/${accountname}/.redis/
@shanerutter
shanerutter / develop.ps1
Created March 26, 2022 09:42
docker develop control file - windows ps
#######################
# CONFIG #
#######################
$COMPOSE_FILE="dev"
$PROJECT_NAME = ""
#######################
# DO NOT TOUCH BELOW ##
#######################
@shanerutter
shanerutter / Dockerfile
Last active April 27, 2022 10:14
dockerfile - php8.1-fpm - laravel dev
FROM php:8.1-fpm
# Update
RUN apt-get update -y
# Packages
RUN apt install -y nano git zip unzip libicu-dev zlib1g-dev libpng-dev libonig-dev curl libzip-dev
# PHP Exts
RUN docker-php-ext-install exif pdo_mysql intl opcache gd mysqli mbstring bcmath zip pcntl
@shanerutter
shanerutter / woocommerce-all-products-visibility-to-all.sql
Created April 7, 2021 18:34
Set all products visiblity to all instead of search or listing only.
DELETE FROM djqns_term_relationships
WHERE term_taxonomy_id IN (6,7)
AND object_id IN (
SELECT id FROM djqns_posts
WHERE post_type = 'product'
AND post_parent = 0
)
#!/bin/sh
doms=`virtualmin list-domains --with-feature ssl --name-only`
for dom in $doms; do
virtualmin generate-letsencrypt-cert --domain $dom
done
@shanerutter
shanerutter / sftp-server-setup.sh
Last active October 17, 2022 12:32
SFTP server for ubuntu servers
#!/bin/sh
# Update hostname
echo "Please provide hostname:"
read hostname
echo $hostname > /etc/hostname
# Public address
echo "Please provide public address (ip address or hostname):"
read publicAddress