[Quick Links] |
Search Site

Site Details

rendered in 0.0919 secs

Captain's Log | Monday 28th of August 2017

Proxmox slow backups - 10Mb/s | nfs network ref

Please take a look at the end of http://pve.proxmox.com/wiki/Performance_Tweaks
The issue with backups may be due to the default bandwidth limit of 10Mb/s

Captain's Log | Monday 28th of August 2017

Character Entity Reference Chart | html special chars


Captain's Log | Monday 28th of August 2017

after upgrading mysql i'm getting: Fetch of persistent statistics requested for table but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead. | error issue 5.5 5.6 5.7 ref

Always run the below after a MySQL DB upgrade.
mysql_upgrade -uroot -p

Captain's Log | Monday 28th of August 2017

Book review: Mindfulness: An Eight-Week Plan for Finding Peace in a Frantic World

I really didn't like it. First 25% was spent talking about how all these various studies are evidence of the books teachings and then it just rambles on without giving any actual actionable information.

How to I direct script output to null? this could help me with my cron tasks* * * * * /home/rick111/purge_rick111.sh > /dev/null 2>&1Symbolic links, which way what? | linuxln -s /exiting/main/must/be/full/path/file.txt /my/shortcut/linky/stub/folder/How can I see how fast my CPU is running, what frequency clock Mhz it's at?watch -n1 "lscpu | grep 'MHz' | awk '{print $1}'"
watch -n1 "lscpu | grep 'CPU MHz' | awk '{print $1}'"
How can I disable the gnome-keyring-daemon?sudo chmod -x /usr/bin/gnome-keyring-daemon
sudo reboot
How do I enable and/or disable sites in apache2? (mod)sudo a2ensite
sudo a2dissite
Book review: On the Shortness of Life
I don't know. Maybe I'm getting old a grumpy but many words are said without giving actual solid advice. I guess the overall message is time is precious so don't be wasteful of it. - but what does that actually mean? I mean, if I wake up tomorrow morning and think "ahhhh, no wasteful time today, great let's get started". I still have to do 80% of the things I do each day to make sure there is food on the table for the family and then I relax with the other 20%, and you know what, I live quite a happy life. What is "wasteful", how can I challenge that idea when it can't even be defined clearly. It's just another book full of empty unquantifiable words and phases that leave me feeling frustrated because I like to hold a set of beliefs that can be challenged.

So no, I don't recommend this great philosopher's words and mumbo jumbo stories that skate around any actual advice.

Captain's Log | Monday 28th of August 2017

CamelCase under_scores firstLetterLowerCase what are the best formats for class, method and file names?

I give up, use this as the styling/naming convention guide
spilt each (model/controller/method/library/view) into:

same as controller/model/library naming convention below
how to name and load methods, models, libraries etc within the file
Controllers: Firstlettercapitalonly (and Libraries). See this post for importance of ending phpunit test files with BlashTest (capital T in test)

Models: Capitalstartonly_but_can_have_underscore (CI is happy with underscores, mess detector is not...)
Views: always_lower_and_can_have_underscores
Methods: lowerStartThenCamelNoUnderscores

URL links, loading libraries and models
  always lower, so https://dev.vpnova.com/Nc/viewGroup/5 should be https://dev.vpnova.com/nc/viewgroup/5
  $this->load->MyModel should be $this->load->mymodel, same for libraries. The $this->mymodel->MyMethod (method) can be CamelCase
variable name formats

table names
in code use "//deleteme dd/mm/yy" as comment for anything that looks obsolete. then you can grepr through project and remove anything that's been in that state for a while

Captain's Log | Friday 25th of August 2017

Remove proxmox subscription warning v4 and 5 | popup license

sed -i s/"data.status !== 'Active'"/false/ /usr/share/pve-manager/*/pvemanagerlib.js

Captain's Log | Monday 14th of August 2017

How do I add a user to sudo group?su
enter root password when prompted
# User privilege specification
root    ALL=(ALL:ALL) ALL

userNameToAdd ALL=(ALL) ALL
service sudo restart
.. test it
How can I get a basic stack up in debian?sudo apt-get install aptitude
sudo aptitude install ~pstandard ~pimportant ~prequired
How can I make sure my debian terminal is giving me full colour (color) support with vim?vim .bashrc
export TERM=xterm-256color

sudo apt-get install vim-gnome

vim ~/.vimrc
:syntax enable
Can I mount a share over SSH?sudo apt-get install sshfs
sudo mkdir /mnt/daniel    local path we're going to use for remote mount
sudo chown $USER:$USER daniel   now I mention this step at it's completely useless but I want you to see why
ls -lah
total 20K
drwxr-xr-x  5 root    root    4.0K Jun 24 06:54 .
drwxr-xr-x 25 root    root    4.0K Mar  5 10:02 ..
drwxr-xr-x  3 root    root    4.0K Mar  5 09:52 boot-sav
drwxr-xr-x 10 rick111 rick111 4.0K Jun 23 04:33 sophie
drwxr-xr-x  2 rick111 rick111 4.0K Jun 24 06:54 daniel

sudo sshfs -o allow_other -p1337 rick111@ /mnt/daniel/  -p1337 use port 1337 of remote ssh server
ls -lah
total 20K
drwxr-xr-x  5 root    root    4.0K Jun 24 06:54 .
drwxr-xr-x 25 root    root    4.0K Mar  5 10:02 ..
drwxr-xr-x  3 root    root    4.0K Mar  5 09:52 boot-sav
drwxr-xr-x 10 rick111 rick111 4.0K Jun 23 04:33 sophie
drwxr-xr-x  1 root    root    4.0K Jun 19 18:53 daneil

Okay, take a peek. Permission of the folder has been changed to root, probably because we made it under /mnt/ rather than /home/dave/media/ but whatever. If you use the "-o allow other" option as we did you can still access the mount, if you had missed out that option you would just see a load of "????????????" question marks when you run ls -lah against the /mnt/ for that folder name and would be unable to access anything within.

Can I auto mount this at boot?
probably. i've not got round to that yet as ssh-cop-id doesn't seem to apply for the auto connect of sshfs and I also need to usual a different port from usual and stuff so.

to unmount
sudo umount /mnt/daniel
Book review: Smalltalk Best Practice Patterns
Not for me. I enjoy it more when the philosophy behind methods are the discussed at detail and then the occasional code snippet to solidify the example. A lot of spam code which isn't a bad thing in general it all just comes down to how you learn best, and for me I like to hear the reasoning behind the numbers, rather than the equations.
What's the difference between CTRL + Z and CTRL + C to end a process?
CTRL+Z pauses a job
CTRL+C terminates a job
Here is an example of pausing a job and then resuming it.
sudo tail -f /var/log/maillog
  [2]+  Stopped                 sudo tail -f /var/log/maillog
  [1]-  Stopped                 sudo tail -f /var/log/maillog
  [2]+  Stopped                 sudo tail -f /var/log/messages

fg %2   (switch back and resume job2)
  sudo tail -f /var/log/maillog
  Jun  8 16:02:32 mail dovecot: imap-login: Login: user= ...blah
  Jun  8 16:02:32 mail dovecot: imap-login: Login: user= ...blah
  Jun  8 16:02:32 mail dovecot: imap-login: Login: user= ...blah
  Jun  8 16:02:32 mail dovecot: imap-login: Login: user= ...blah
  Jun  8 16:03:34 mail postfix/anvil[20343]: statistics: max connection rate 1/60s  ...blah
  Jun  8 16:03:34 mail postfix/anvil[20343]: statistics: max connection count 1 for  ...blah
  Jun  8 16:03:34 mail postfix/anvil[20343]: statistics: max cache size 1 at  ...blah

  You can also start a job in the background by adding & to the end of your command. The job will start in the background and output progress but you can still type whatever into bash

Captain's Log | Monday 14th of August 2017

I've setup an nfs share and everything looks correct but it just won't mount!

If you've only just installed the "apt-get install nfs-kernel-server nfs-common", configured /etc/exports and restarted the service let me stop you right there. You need to reboot your server to get the cogs in motion for the first time after installing the tools. Sorry.

Whilst talking of mounts, how do I browse mounts on a server and then..... erm, mount one?

make sure you've got sudo apt-get install nfs-common
showmount -e
    if it returns 'clnt_create: RPC: Program not registered', make sure you've rebooted the host running nfs after the initial installation/setup of nfs
Export list for

sudo mkdir /mnt/sophie  local path we're going to use for remote mount
sudo mount /mnt/sophie

You've done all the hard work now, make sure you add an entry in fstab so it mounts after reboot.
sudo vim /etc/fstab
+ /mnt/sophie nfs defaults 0 0

bounce your box and make sure it all works as expected.

Captain's Log | Monday 14th of August 2017

Windows Server Reboots

@echo off
echo You're about to start rebooting all of the servers,
echo please close this script if opened in error.
echo shutdown -a will abort the shutdown
echo Automatic reboot process will begin in 15 seconds
timeout 15
shutdown /m \\SRV-DC1 /r /f /t 60 /d p:1:1
shutdown /m \\SRV-LEO1 /r /f /t 60 /d p:1:1
shutdown /m \\SRV-LEO2 /r /f /t 60 /d p:1:1
shutdown /m \\SRV-WA /r /f /t 60 /d p:1:1
echo waiting 5 minutes to continue
timeout 600
shutdown /m \\SRV-DC2 /r /f /t 60 /d p:1:1
shutdown /m \\SRV-MAN1 /r /f /t 60 /d p:1:1
shutdown /m \\SRV-MAN2 /r /f /t 60 /d p:1:1

echo waiting 5 minutes to continue
timeout 600
shutdown /m \\SRVDB /r /f /t 60 /d p:1:1
shutdown /m \\SRV-FS /r /f /t 60 /d p:1:1
shutdown /m \\SRVMAN1 /r /f /t 60 /d p:1:1
shutdown /m \\SRVGW1 /r /f /t 60 /d p:1:1
echo script complete
Get-Uptime retrieves boot up information from a Aomputer.
Get-Uptime uses WMI to retrieve the Win32_OperatingSystem
LastBootuptime property. It displays the start up time
as well as the uptime.

Created By: Jason Wasser @wasserja
Modified: 8/13/2015 01:59:53 PM  
Version 1.4

* Added Credential parameter
* Changed to property hash table splat method
* Converted to function to be added to a module.

.PARAMETER ComputerName
The Computer name to query. Default: Localhost.
Get-Uptime -ComputerName SERVER-R2
Gets the uptime from SERVER-R2
Get-Uptime -ComputerName (Get-Content C:\Temp\Computerlist.txt)
Gets the uptime from a list of computers in c:\Temp\Computerlist.txt.
Get-Uptime -ComputerName SERVER04 -Credential domain\serveradmin
Gets the uptime from SERVER04 using alternate credentials.
Function Get-Uptime {
    param (
        $Credential = [System.Management.Automation.PSCredential]::Empty


    #Need to verify that the hostname is valid in DNS
    process {
        foreach ($Computer in $ComputerName) {
            try {
                $hostdns = [System.Net.DNS]::GetHostEntry($Computer)
                $OS = Get-WmiObject win32_operatingsystem -ComputerName $Computer -ErrorAction Stop -Credential $Credential
                $BootTime = $OS.ConvertToDateTime($OS.LastBootUpTime)
                $Uptime = $OS.ConvertToDateTime($OS.LocalDateTime) - $boottime
                $propHash = [ordered]@{
                    ComputerName = $Computer
                    BootTime     = $BootTime
                    Uptime       = $Uptime
                $objComputerUptime = New-Object PSOBject -Property $propHash
            catch [Exception] {
                Write-Output "$computer $($_.Exception.Message)"
Get-Uptime -ComputerName SRV-WA
Get-Uptime -ComputerName SRVDB
Get-Uptime -ComputerName SRV-DC1
Get-Uptime -ComputerName SRV-DC2
Get-Uptime -ComputerName SRV-FS
Get-Uptime -ComputerName SRVGW1
Get-Uptime -ComputerName SRV-LEO1
Get-Uptime -ComputerName SRV-LEO2
Get-Uptime -ComputerName SRVMAN1
Get-Uptime -ComputerName SRV-MAN1
Get-Uptime -ComputerName SRV-MAN2
Get-Uptime -ComputerName SRV-VSPHERE
Write-Host "sleeping for 12 seconds"

    $a = Get-Date
    Write-Host Date: $a
    Write-Host -------------------------
Start-Sleep -s 11

Captain's Log | Monday 14th of August 2017

nfs mount export not working | linux

rebootI'd followed every guide under the sun, finished with an exportfs -a but kept getting connection timed out when trying to conenct from client. Had to reboot host, this happened the other day as well, same fix.

nfs is shit take 2

was still having issues and came across the below from here. sorted shit out for me.
# Provides: nfs-re-restart
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 5
# Default-Stop: 0 1 6
# Short-Description: Starts nfs daemin at the end of boot
# Description: restart-nfs

sleep 45
sudo /etc/init.d/nfs-kernel-server stop
logger NFSoff
echo NFS_is_stopping
sudo /etc/init.d/rpcbind stop
logger RPCoff
echo RPC_is_stopping
sudo /etc/init.d/nfs-kernel-server start
logger NFSon
echo NFS_is_starting
sudo /etc/init.d/rpcbind start
logger RPCon
echo RPC_is_starting

Captain's Log | Friday 11th of August 2017

setup bare repo on external server to work with submodules and post-receive hooks, ref | new

on remote:
mkdir /home/www.example.com/public_html && cd /home/www.example.com/public_html
git init
mkdir /home/www.example.com/repo.git && cd /home/www.example.com/repo.git
git init --bare
vim /home/www.example.com/repo.git/hooks/post-receive
cd /home/www.example.com/public_html
git pull /home/www.example.com/repo.git
git submodule sync ; git submodule update --init --recursive
chmod +x /home/www.example.com/repo.git/hooks/post-receive
  note to rp: see ln site setup for help. well done, now everyone can clone your site from http://www.example.com/.git - make sure you have .git being blocked via .htaccess
  Put this in an .htaccess file at the root of your web server: src
RedirectMatch 404 /\.git

on local:
git clone ssh://example@www.example.com/home/www.example.com/repo.git
cd libraries
  don't do this step if it's a empty new bare repo, go and commit some data first or the .gitmodules file won't be created when run the command below
git submodule add ssh://dave@vpnova.com/home/dave/libraries/tracker.git
cd ..
git commit -av
git push

Captain's Log | Tuesday 8th of August 2017

Server Security Document | certificate

currently trying to get .htpasswd password attempts to be blocked via CSF. changed fghgf to use default apache log location as the auth failures for the virtualmin error log weren't getting log, but after updating site to use default apache one the errors arn't being logged at all, going to revert fghf error log back to /var/log/virtualmin/fghgf.com_error_log from /var/log/apache2/error.log and have another go next time

now it's not even logging to /var/log/virtualmin/fghgf.com_error_log | not even rebooting the server has fixed the logging. works on loopnova though



ChallengeResponseAuthentication no was no by default, other two were yes
PasswordAuthentication no
UsePAM no
I can still SFTP even with password authentication turned off - FileZilla, even though asking for password, will be using RSA from an earlier successful connection. It won't work on a "fresh" filezilla session/install.

use keys to access server with password disabled

  on your machine
cat ~/.ssh/id_rsa.pub
  on server you're connecting to, go to the user's profile you want to be auto logged in as and:
echo public_key_string >> ~/.ssh/authorized_keys