Skip to content

Instantly share code, notes, and snippets.

@sokolenkoDEV
sokolenkoDEV / check_backup_enabled.sh
Created August 2, 2018 01:45
isp manager 5 check users who enabled backups
#!/bin/bash
for USER in `/usr/local/mgr5/sbin/mgrctl -m ispmgr user | sed 's/name=\(\w*\).*/\1/g'`; do
BACKUP_ENABLED=`/usr/local/mgr5/sbin/mgrctl -m ispmgr backup2.settings su=$USER | grep -c "enabled=on"`
if [[ "$BACKUP_ENABLED" -ne "0" ]]; then
echo "$USER"
fi
done
@sokolenkoDEV
sokolenkoDEV / test_website.sh
Created July 31, 2018 23:53
periodically check abailability of website
#!/bin/bash
WEBSITE="mybash.tk"
EMAIL="ihc.ru.test@gmail.com"
TIMER=60 #how often send emails in seconds
SLEEP_TIMER=10 # how often check availability of website
#dont change STATUS variable it's default value
STATUS=1
server {
listen 127.0.0.1:80;
ssi on;
gzip on;
gzip_comp_level 7;
gzip_types application/x-javascript application/javascript text/css;
server_name test.ru www.test.ru;
charset off;
#disable_symlinks if_not_owner from=$root_path;
@sokolenkoDEV
sokolenkoDEV / dhclient.service
Created October 7, 2017 19:27
virtualbox ubuntu17 how to up network
#add unit
#then systemctl enable dhclient.service
#then systemctl start dhclient.service
cat /etc/systemd/system/dhclient.service
[Unit]
Description=DHCP Client
Documentation=man:dhclient(8)
Wants=network.target
@sokolenkoDEV
sokolenkoDEV / isp5_domains_NS_change.sh
Last active October 5, 2017 12:42
ispmanager 5 change old NS to new
#old ns - ns1.example.com ns2.example.com
#new ns - new1.ns.com new2.ns.com
#!/usr/bin/bash
cd /root/;
#Вывести список всех доменов
echo -e "\e[1;32m Get list of domains\e[0m"
/usr/local/mgr5/sbin/mgrctl -m ispmgr domain | awk '{print $1}' | awk -F= '{print $2}' > domain-list.txt
#Проверить NS севреры для доменов
echo -e "\e[1;32m Get list of domains with bad NS\e[0m"
@sokolenkoDEV
sokolenkoDEV / perl_replacer.pl
Last active September 30, 2017 20:37
Perl: replace in file
# change plugin in wordpress Auto SyntaxHighlighter -> Enlighter - Customizable Syntax Highlighter
# dump site database to mybash-2017-30-09.sql
# write script to replace
<pre class=\"brush:php\">
<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">
#!/usr/bin/perl
use warnings;