📜 ⬆️ ⬇️

Our bike or scripts to facilitate the life of the admin

image
In the comments to one of the previous articles, there was a request to put on public display all our practices used in everyday life. Together, everything was collected, described and posted on github.
Under the cat link to the repository and a brief description of the scripts.


Repository link: github.com/olemskoi/centos-admin
Here is a brief description of the scripts and how to work with them.

1. admin.sh

use ./admin.sh <create | remove> [ip]
')
Creates a site under the template. That is, nginx apache configs, makes a reload of services and creates a mysql and / or postgresql database. Depending on the presence of the /root/.mysql file /root/.postgresql.
It also creates an FTP account based on pure-ftpd.
Information on access displays in STDOUT.

use ./admin.sh <mysql | postgresql> Creates a database. Information on access displays in STDOUT.

use ./admin.sh <change_root_pass> <mysql | postgresql>

Changes the superuser password.

2. apache-top.py, apachetop.sh

Script showing apache requests in real time.
Requires some nginx configuration:
location / apache-status {
proxy_pass 127.0.0.1 : 8080;
proxy_redirect off;
proxy_set_header Host $ host;
proxy_set_header X-Real-IP $ remote_addr;
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;

proxy_read_timeout 300;
client_max_body_size 256m;

proxy_buffer_size 16k;
proxy_buffers 32 16k;
}
As well as apache settings:
ServerName localhost

<Location / apache-status>
SetHandler server-status


3. cacti-php-fpm.sh

Script for setting up web services for monitoring php-fpm in cacti

4. highload-report.sh

The script collects complete information about the system at a particular point in time and sends information to the mail:
*) process list, sorting by CPU
*) process list, sort by MEM
*) mysql query list
*) apache request list
*) nginx request list
*) list of netstat connections sorted by ip
*) total TCP / UDP sessions
*) mysql status

The script starts monit when la> X

5. httpd-restart.sh

Just restart apache, need for monit

6. maldet.sh

Script to check websites for viruses, uses maldet

7. mongodb-backup.sh

The mongoDB backup script. Made from mysql-backup.sh

8. mysql-backup.sh

Mysql backup Detailed description in this article.

9. mysql-slave-check.sh

The script checks the status of the mysql slave with the notification.

10. mysql-table-check.sh

Script Table Verification

11. php-cron.sh

Script for adding php cron tasks

12. postfix.sh

Stop / start postfix, need for monit.

13. postgresql-backup.sh

The postgresql backup script. It works in the same way as mysql-backup.sh with the exception of its special features.

14. redis-backup.sh

Script backup redis. It works in the same way as mysql-backup.sh with the exception of its special features.

15. redis-ping.sh

Script checking liveliness redis.

16. rstr-xtra-mysql.sh

The script to work with mysql xtrabackup

17. unicornstat.pl, unicornstat.sh

Script for getting statistics on unicorn work

18. vz-exec.pl

Script for governing openvz containers via ssh

Source: https://habr.com/ru/post/235131/


All Articles