This file contains 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
### ProFTPd | |
/etc/proftpd/proftpd.conf | |
PassivePorts 49152 65535 | |
MasqueradeAddress <External-IP of NAT> | |
### Load modules to kernel | |
/sbin/modprobe nf_conntrack_ftp | |
/sbin/modprobe nf_nat_ftp | |
### Add two lines to the file for storing permanent |
This file contains 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
# https://stackoverflow.com/questions/19630994/how-to-check-if-a-string-is-a-valid-regex-in-python | |
def isValidRe(regex): | |
import re | |
try: | |
re.compile(regex) | |
is_valid = True | |
except re.error: | |
is_valid = False | |
return is_valid |
This file contains 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
def count_substring(string, sub_string): | |
import re | |
match = re.findall('(?='+sub_string+')',string) | |
return len(match) |
This file contains 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
REFERENCE: | |
http://hzcsky.blog.51cto.com/1560073/479476 | |
# $Id: mysql-replication 335 2005-10-13 19:46:20Z sbalukoff $ | |
# To set up bi-directional mysql replication: | |
# For the purposes of this document, we have two servers which will in the | |
# end be filling a co-master type relationship. However, since when you set up | |
# this replication there will probably be one machine with all the data on it | |
# that needs to be brought into sync with the other machine, the machine |
This file contains 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 | |
# PARAM | |
mysql_master=<%= @DBMY_MASTER_HOST %> | |
user_mysql=root | |
password_user_mysql=<%= @USER_ROOT_DBMY_SLAVE_PASSWORD %> | |
replication_user=<%= @REP_USER %> | |
replication_password=<%= @REP_PASSWORD %> | |
read -p "Etes vous sur de vouloir installer la replication ? [Y/N]" -n 1 -r |
This file contains 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
``` | |
## Master-1 | |
create database replica_db; | |
create user 'slave'@'10.10.22.104' identified by 'abc@123'; | |
create user 'slave'@'10.10.22.105' identified by 'abc@123'; | |
grant replication slave on *.* to 'slave'@'10.10.22.104' identified by 'abc@123'; | |
grant replication slave on *.* to 'slave'@'10.10.22.105' identified by 'abc@123'; | |
vi /etc/my.cnf.d/mariadb-server.cnf | |
[mariadb] |
This file contains 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
def getCommandOutput(command): | |
from subprocess import Popen, PIPE | |
proc = Popen(command, stdout=PIPE, stderr=PIPE, shell=True) | |
stdout, stderr = proc.communicate() | |
if stderr.decode("utf-8") == "": | |
return str(stdout.decode("utf-8")) | |
return "" | |
def getCommandError(command): | |
from subprocess import Popen, PIPE |
This file contains 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
FROM centos:centos7 | |
ENV container docker | |
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ | |
systemd-tmpfiles-setup.service ] || rm -f $i; done); \ | |
rm -f /lib/systemd/system/multi-user.target.wants/*;\ | |
rm -f /etc/systemd/system/*.wants/*;\ | |
rm -f /lib/systemd/system/local-fs.target.wants/*; \ | |
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ |
This file contains 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
yum install -y epel-release | |
sudo yum install -y sshfs |
This file contains 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
https://unix.stackexchange.com/questions/392780/how-to-schedule-an-rsync-command | |
There are two ways to use cron, by creating a file in /etc/cron.d/repo-sync with the format: | |
<minute> <hour> <day_of_month> <month> <day_of_week> <user> <command> | |
For example, to run rsync from src to dest at 19:00 every day you can use: | |
0 19 * * * root rsync -a src dest | |
Or you can create a crontab by running crontab -e (as the user you want to run the command as) with a line | |
like above minus the user such as: |