copytruncate: Truncate the original log file in place after creating a copy.
An example: /etc/logrotate.d/mds
/var/log/mds/mds-app-*.log {
daily
copytruncate
rotate 30
dateext
missingok
notifempty
sharedscripts
}
/var/log/mds/mds-app-*.log {
daily
copytruncate
rotate 30
dateext
missingok
notifempty
sharedscripts
}
# Socket Receive Buffer net.core.rmem_max = 4194304 # Socket Send Buffer net.core.wmem_max = 16777216load the changes:
sudo sysctl -p 4194304 = 4 MB 16777216 = 16 MB
Package: apparmor Pin: release * Pin-Priority: -1Reference: https://wiki.debian.org/AptConfiguration#Prevent.2Fselective_installation_from_third-party_a_repository
sudo apt-get install -y cloud-utils################### ### Before ########## ###################
df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 16G 11G 4.2G 72% / /dev/sdb1 295G 247G 33G 89% /data################### ### grow /dev/sdb1 ### ###################
echo 1 > /sys/class/block/sdb/device/rescan growpart /dev/sdb 1 CHANGED: partition=1 start=2048 old: size=629143552 end=629145600 new: size=880801759,end=880803807 resize2fs /dev/sdb1 resize2fs 1.44.5 (15-Dec-2018) Filesystem at /dev/sdb1 is mounted on /data; on-line resizing required old_desc_blocks = 38, new_desc_blocks = 53 The filesystem on /dev/sdb1 is now 110100219 (4k) blocks long.################### ### grow /dev/sda1 ### ###################
echo 1 > /sys/class/block/sda/device/rescan growpart /dev/sda 1 CHANGED: partition=1 start=2048 old: size=33550336 end=33552384 new: size=83883999,end=83886047 resize2fs /dev/sda1 resize2fs 1.44.5 (15-Dec-2018) Filesystem at /dev/sda1 is mounted on /; on-line resizing required old_desc_blocks = 2, new_desc_blocks = 5 The filesystem on /dev/sda1 is now 10485499 (4k) blocks long.################### ### After ########### ###################
df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 40G 11G 27G 29% / /dev/sdb1 413G 247G 146G 63% /data
# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: active (running) since Mon 2022-09-26 17:47:50 EDT; 2 weeks 1 days ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 443 (systemd-timesyn)
Status: "Synchronized to time server for the first time 208.81.1.244:123 (0.debian.pool.ntp.org)."
Tasks: 2 (limit: 4722)
Memory: 1.7M
CGroup: /system.slice/systemd-timesyncd.service
└─443 /lib/systemd/systemd-timesyncd
Sep 26 17:47:50 Minecraft systemd[1]: Starting Network Time Synchronization...
Sep 26 17:47:50 Minecraft systemd[1]: Started Network Time Synchronization.
Sep 26 17:47:50 Minecraft systemd-timesyncd[443]: Synchronized to time server for the first time 208.81.1.244:123 (0.debian.pool.ntp.org).
Update the configuration: /etc/systemd/timesyncd.conf
[Time] NTP=ca.pool.ntp.org FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org RootDistanceMaxSec=5 PollIntervalMinSec=32 PollIntervalMaxSec=2048Restart the systemd-timesyncd.service
root@Minecraft:~# systemctl restart systemd-timesyncd.service
root@Minecraft:~# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: active (running) since Tue 2022-10-11 20:11:36 EDT; 3s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 1796 (systemd-timesyn)
Status: "Synchronized to time server for the first time 209.115.181.110:123 (ca.pool.ntp.org)."
Tasks: 2 (limit: 4722)
Memory: 1.3M
CGroup: /system.slice/systemd-timesyncd.service
└─1796 /lib/systemd/systemd-timesyncd
Oct 11 20:11:36 Minecraft systemd[1]: Starting Network Time Synchronization...
Oct 11 20:11:36 Minecraft systemd[1]: Started Network Time Synchronization.
Oct 11 20:11:36 Minecraft systemd-timesyncd[1796]: Synchronized to time server for the first time 209.115.181.110:123 (ca.pool.ntp.org).
remote: perl: warning: Setting locale failed.
remote: perl: warning: Please check that your locale settings:
remote: LANGUAGE = (unset),
remote: LC_ALL = (unset),
remote: LANG = "en_CA.UTF-8"
remote: are supported and installed on your system.
remote: perl: warning: Falling back to the standard locale ("C").
Spent a lot of time try to set the LANGUAG, LC_ALL and LANG on the git client side.
None of them works.
End up rebuild locales on the gitolite3 host server:
sudo locale-gen en_US en_US.UTF-8 sudo dpkg-reconfigure locales
mds@debian:~# dpkg -l|grep irq ii irqbalance 1.5.0-3 amd64 Daemon to balance interrupts for SMP systems root@download:~# dpkg --purge irqbalance (Reading database ... 32086 files and directories currently installed.) Removing irqbalance (1.5.0-3) ... Purging configuration files for irqbalance (1.5.0-3) ... Processing triggers for systemd (241-7~deb10u7) ...
deb http://deb.debian.org/debian/ jessie main deb http://security.debian.org/ jessie/updates main deb http://archive.debian.org/debian/ jessie-backports mainAnd Debian wheezy: /etc/apt/sources.list
deb http://archive.debian.org/debian/ wheezy main deb http://archive.debian.org/debian/ wheezy-backports main deb http://archive.debian.org/debian-security/ wheezy/updates mainChange the file, then:
apt-get clean all apt-get updateYou may get some error like:
W: GPG error: http://archive.debian.org wheezy Release: The following signatures were invalid: KEYEXPIRED 1587841717 KEYEXPIRED 1557241909 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 W: GPG error: http://archive.debian.org wheezy-backports Release: The following signatures were invalid: KEYEXPIRED 1587841717 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 W: GPG error: http://archive.debian.org wheezy/updates Release: The following signatures were invalid: KEYEXPIRED 1587841717 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906Fix:
apt-key adv --recv-key --keyserver keyserver.ubuntu.com 7638D0442B90D010 apt-key adv --recv-key --keyserver keyserver.ubuntu.com 9D6D8F6BC857C906Error 2:
E: Release file for http://archive.debian.org/debian-security/dists/wheezy/updates/Release is expired (invalid since 419d 23h 58min 55s). Updates for this repository will not be applied.Fix:
echo "Acquire::Check-Valid-Until false;" | tee -a /etc/apt/apt.conf.d/10-nocheckvalidJust keep apt-get clean and apt-get update.
Unattended-Upgrade::Origins-Pattern {
"origin=Debian,codename=${distro_codename},label=Debian-Security";
"origin=nginx,label=nginx";
"site=packages.sury.org";
};
I have to add one extra line:
"origin=Debian,codename=${distro_codename},label=Debian";
Then the Kernel upgrade got pickup.
Unattended-Upgrade::Origins-Pattern {
"origin=Debian,codename=${distro_codename},label=Debian";
"origin=Debian,codename=${distro_codename},label=Debian-Security";
"origin=nginx,label=nginx";
"site=packages.sury.org";
};
Reference of the fix for this bug:
Unattended-Upgrade::Origins-Pattern {
...
"origin=nginx,label=nginx";
"site=packages.sury.org";
};
# unattended-upgrade --debug --dry-run Initial blacklisted packages: Initial whitelisted packages: Starting unattended upgrades script Allowed origins are: ['origin=Debian,codename=stretch,label=Debian-Security', 'origin=nginx,label=nginx', 'site=packages.sury.org'] pkgs that look like they should be upgraded: Fetched 0 B in 0s (0 B/s) fetch.run() result: 0 blacklist: [] whitelist: [] No packages found that can be upgraded unattended and no pending auto-removals
# dpkg -l|grep check-mk ii check-mk-agent 1.2.8p15-1 all Check_MK Agent for Linux ii check-mk-raw-1.4.0p8 0.jessie amd64 Check_MK is a full featured system monitoring # wget https://mathias-kettner.de/support/1.4.0p36/check-mk-raw-1.4.0p36_0.jessie_amd64.deb # sudo dpkg -i check-mk-raw-1.4.0p36_0.jessie_amd64.deb Selecting previously unselected package check-mk-raw-1.4.0p36. (Reading database ... 54001 files and directories currently installed.) Preparing to unpack check-mk-raw-1.4.0p36_0.jessie_amd64.deb ... Unpacking check-mk-raw-1.4.0p36 (0.jessie) ... Setting up check-mk-raw-1.4.0p36 (0.jessie) ... New default version is 1.4.0p36.cre. update-alternatives: using /omd/versions/1.4.0p36.cre to provide /omd/versions/default (omd) in manual mode Installing systemd service: omd.init Disabling startup through SysV (/etc/init.d/*) scripts Activating startup during system boot Processing triggers for systemd (215-17+deb8u7) ... Processing triggers for man-db (2.7.0.2-5) ...
# su - milllion-doller-server OMD[milllion-doller-server]:~$ omd status mkeventd: running rrdcached: running npcd: running nagios: running apache: running crontab: running ----------------------- Overall state: running OMD[milllion-doller-server]:~$ omd update Please completely stop 'milllion-doller-server' before updating it. OMD[milllion-doller-server]:~$ omd stop Removing Crontab...OK Stopping dedicated Apache for site milllion-doller-server....OK Stopping nagios......OK Stopping npcd...OK Stopping rrdcached...waiting for termination...OK Stopping mkeventd...killing 21922....OK OMD[milllion-doller-server]:~$ omd update Unmounting temporary filesystem...OK Cleaning up temp filesystem...OK +-------------------------------------------------------------+ | You are going to update the site milllion-doller-server | | from version 1.4.0p8.cre to version | | 1.4.0p36.cre. This will include updating all of | | you configuration files and merging changes in | | the default files with changes made by you. In | | case of conflicts your help will be needed. | +-------------------------------------------------------------+ |< Abort > | +-------------------------------------------------------------+ 2018-09-28 13:32:09 - Updating site 'milllion-doller-server' from version 1.4.0p8.cre to 1.4.0p36.cre... * Updated etc/nagvis/nagvis.ini.php * Updated etc/nagvis/conf.d/demo.ini.php Finished update.
OMD[milllion-doller-server]:~$ omd start Creating temporary filesystem /omd/sites/milllion-doller-server/tmp...OK Starting mkeventd...OK Starting rrdcached...OK Starting npcd...OK Starting nagios...2018-09-28 13:32:15 [6] updating log file index 2018-09-28 13:32:15 [6] updating log file index OK Starting dedicated Apache for site milllion-doller-server...OK Initializing Crontab...OK OMD[milllion-doller-server]:~$ omd status mkeventd: running rrdcached: running npcd: running nagios: running apache: running crontab: running ----------------------- Overall state: running
apt-get install curl dirmngr gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB curl -sSL https://get.rvm.io | bash -s stable source /etc/profile.d/rvm.sh rvm requirements rvm install 2.4 rvm use 2.4 --default ruby -v echo "gem: --no-ri --no-rdoc" >> ~/.gemrc gem install bundler --no-ri --no-rdoc gem install sqlite3 --no-ri --no-rdoc cd /var/www/redmine/ cp config/database.yml.example config/database.yml
production: adapter: sqlite3 database: db/redmine.sqlite3
bundle install --without development test rmagick bundle exec rake generate_secret_token RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake redmine:load_default_data
bundle exec rails server webrick -e production -b 192.168.1.33 -p 80
[Unit] Description=Redmine server After=syslog.target After=network.target [Service] Type=simple User=root Group=root ExecStart=/bin/bash -c 'source /etc/profile.d/rvm.sh && cd /var/www/redmine && bundle exec rails server webrick -e production -b 192.168.1.33 -p 80' # Give a reasonable amount of time for the server to start up/shut down TimeoutSec=300 [Install] WantedBy=multi-user.target
systemctl enable redmine.service systemctl start redmine.service
systemLog: logAppend: true logRotate: reopen
/var/log/mongodb/*.log {
daily
rotate 10
dateext
missingok
notifempty
sharedscripts
postrotate
/bin/kill -SIGUSR1 `cat /var/lib/mongodb/mongod.lock 2> /dev/null` 2> /dev/null || true
endscript
}
# service xinetd stop # apt-get purge xinetd Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libfile-copy-recursive-perl libx265-79 update-inetd Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: xinetd* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 255 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 34520 files and directories currently installed.) Removing xinetd (1:2.3.15-3) ... Purging configuration files for xinetd (1:2.3.15-3) ... Processing triggers for man-db (2.7.0.2-5) ...
# apt-get autoremove Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libfile-copy-recursive-perl libx265-79 update-inetd 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. After this operation, 3,244 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 34490 files and directories currently installed.) Removing update-inetd (4.43) ... Removing libfile-copy-recursive-perl (0.38-1) ... Removing libx265-79:i386 (1.9-3~bpo8+1) ... Processing triggers for man-db (2.7.0.2-5) ... Processing triggers for libc-bin (2.19-18+deb8u6) ...
# dpkg -l|grep check-mk ii check-mk-agent 1.2.8p12-1 all Check_MK Agent for Linux
# systemctl enable check_mk.socket Created symlink from /etc/systemd/system/sockets.target.wants/check_mk.socket to /etc/systemd/system/check_mk.socket.
# systemctl start check_mk.socket
vrrp_script chk_haproxy { # Requires keepalived-1.1.13
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 51
priority 101 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.0.100
}
track_script {
chk_haproxy
}
} apt-get install psmisc
vrrp_script chk_haproxy {
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
} vrrp_script chk_redis {
script "pidof redis-server" # pidof inside of killall, just to be safe.
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 59
priority 100 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.1.10
}
track_script {
chk_redis
}
} apt-get purge exim4* apt-get install ssmtp bsd-mailx mail -s "OMD test email 7" -S from=test@milliondollarserver.com test@milliondollarserver.com mail -s "OMD test email 7" test@milliondollarserver.com
#Reference:
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
UseTLS=YES
UseSTARTTLS=Yes
mailhub=smtp.gmail.com:587
AuthUser=test@milliondollarserver.com
AuthPass=IFUseeTHISpassWord
AuthMethod=LOGIN
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=monitor.milliondollarserver.com
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
# apt-get install etckeeper
root@milliondollarserver:~# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20 root@milliondollarserver The key's randomart image is: +---[RSA 2048]----+ | | | | | | | o | | oSo E | | +.... .. | | .....o .+=| | ..o +.**| | .o.=.B| +-----------------+
root@milliondollarserver:~# git config --global user.email root@milliondollarserver.com root@milliondollarserver:~# git config --global user.name root@milliondollarserver root@milliondollarserver:~# cd /etc/ root@milliondollarserver:/etc# etckeeper init root@milliondollarserver:/etc# git commit -m "initial checkin" [master 7c33032] initial checkin 4 files changed, 14 insertions(+), 4 deletions(-) delete mode 100644 check_mk/mysql.cfg create mode 100644 python/debian_config create mode 100644 python2.7/sitecustomize.py
cd /etc git remote rm origin git remote add origin gitolite3@git.milliondollarserver.com:etckeeper-milliondollarserver
cd /etc/etckeeper/commit.d (echo ‘#!/bin/sh’ ; echo ‘git push origin’) > 60git-push chmod +x 60git-push
cd /etc git add . git commit -m “automatically push commits to backup repository” /etc# git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
:/etc# git config --global push.default simple :/etc# git push --set-upstream origin master
The authenticity of host 'git.milliondollarserver.com (10.10.10.10)' can't be established. ECDSA key fingerprint is f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'git.milliondollarserver.com,10.10.10.10' (ECDSA) to the list of known hosts. Counting objects: 1080, done. Compressing objects: 100% (717/717), done. Writing objects: 100% (1080/1080), 498.42 KiB | 0 bytes/s, done. Total 1080 (delta 109), reused 0 (delta 0) To gitolite3@git.milliondollarserver.com:etckeeper-sca-app-lb01 * [new branch] master -> master Branch master set up to track remote branch master from origin.

# echo deb http://httpredir.debian.org/debian jessie-backports main | \
sed 's/\(.*\)-sloppy \(.*\)/&@\1 \2/' | tr @ '\n' | \
tee /etc/apt/sources.list.d/backports.list
# apt-get update
# apt-get install haproxy -t jessie-backports
You will get the latest release of HAProxy 1.6.
apt-get install freetds-common freetds-bin unixodbc php5-sybase
service apache2 restart
# Kinamo SQL Server
[test_sqlserver]
host = milliondollarserver.com
port = 1433
tds version = 8.0