sudo rm -r /Library/Server/Wiki
DNS – Stop and Start DNS services in MacOS X
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
Use the terminal to enable or disable sleep functions in OS X
sudo systemsetup -setcomputersleep Never
sudo systemsetup -setcomputersleep 60
sudo systemsetup -getcomputersleep
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.PowerManagement SystemPowerSettings -dict SleepDisabled -bool YES
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.PowerManagement SystemPowerSettings -dict SleepDisabled -bool NO
Set System Date in Mac OS X from Command Line with a Central Time Server
Set System Date in Mac OS X from Command Line with a Central Time Server
sudo ntpdate -u time.apple.com
4 Jul 14:30:11 ntpdate[28267]: adjust time server 17.151.16.14 offset 0.000336 sec
Set the Mac System Date Manually by Terminal Command
date 0712122318
Install Brew on MacOS
Homebrew is used as a package manager for installing applications & utilities through the command line.
Like other Linux package managers, it can also build from source if required.
Enter the below into a Terminal session:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This will download and install Xcode tools which will generally be over 5GB.
Play a MIDI file from the Terminal
Play MIDI files from Terminal
Requirements: Brew (Homebrew) to be installed & configured
Terminal commands:
$ brew install timidity $ timidity file.midi
How to Repair Verify Disk Permissions in OS X El Capitan
Open the Terminal application (found in /Applications/Utilities/) and use the following syntax to verify a volumes permissions, this will verify the default root volume of a Mac:
sudo /usr/libexec/repair_packages --verify --standard-pkgs /
If you want to verify permissions on a different drive, specify the volume rather than “/”
The command will run and either show permissions that differ, or nothing, depending on what’s found. Not surprisingly, you’ll likely find some variation of permissions that differs, looking something like:
Permissions differ on "usr/libexec/cups/cgi-bin", should be drwxr-xr-x , they are dr-xr-xr-x . Permissions differ on "usr/libexec/cups/daemon", should be drwxr-xr-x , they are dr-xr-xr-x . Permissions differ on "usr/libexec/cups/driver", should be drwxr-xr-x , they are dr-xr-xr-x . Permissions differ on "usr/libexec/cups/monitor", should be drwxr-xr-x , they are dr-xr-xr-x .
How to Repair Disk Permissions in OS X El Capitan from Command Line
Assuming permissions have been found which differ and you’d like to repair them, replace the –verify flag with –repair, and again point the command at the same volume
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
Repairing permissions may take a while, just like it did from Disk Utility.
If you execute the repair_packages command without sudo and with no specifications or flags, you’ll get a simple help guide instead:
$ /usr/libexec/repair_packages Usage: repair_packages [ARGUMENTS]... Commands: --help Print this usage guide. --list-standard-pkgs Display the package ids in the standard set. --verify Verify permissions on files in the specified package(s). --repair Repair permissions on files in the specified package(s). Options: --pkg PKGID Verify or repair the package PKGID. --standard-pkgs Verify or repair the standard set of packages. --volume PATH Perform all operations on the specified volume. --output-format # Print progress info using a special output format. --debug Print debuging information while running.
As suggested, this is not really something that should be run on a regular basis as any part of Mac maintenance routine, and it’s rarely necessary, which is likely why Apple pulled it from the Disk Utility application.
Patton SIP Gateway at remote site using 3CX SBC
This guide will demonstrate the use of a Patton SIP Gateway to Analog FXO/FXS connected to 3CX via the SBC gateway.
The use cases for this are where the 3CX instance is hosted, but it needs access to FXO or FXS connections at the client office. It can also be used in scenarios where the client has branch offices with FXO or FXS connection requirements within the 3CX system at head office.
Follow the setup guide for the Patton gateways located below:
FXO: https://www.3cx.com/voip-gateways/patton-smartnode-sn4112/
(for this guide, I used the FXO version)
FXS: https://www.3cx.com/voip-gateways/patton-smartnode-sn4112-fxs/
But don’t follow the whole guide as we need to make alterations to the config file prior to uploading it to the Patton appliance.
Basically, we need to create the SIP Gateway entity in 3CX, export the config, modify it, and upload into the gateway – do the following:
3CX Management > SIP Trunks > Add Gateway
Select Brand: Patton
Select appropriate model or type
Enter the number of ports the device has (not the number you intend to use – must be total)
Enter the main trunk number
Next, enter the local IP address of the device (must be static or DHCP reservation)
Subnet mask: applicable to the gateway’s local network
Tone Selection region: Australia
Number or SIM calls: this is where you specify the number of lines you will be using
Number of physical PSTN ports: should be pre-populated from earlier.
Under options, Dial Delay: Wait for Dial Tone
Hit OK, then go back into the SIP Gateway in 3cx, next to the blue OK button is Generate device config
This will open a new tab or window into the Patton’s import screen and download the config file to your local computer
Open the config in Notepad++ or similar
Locate the 3CX’s local IP address – using find & replace to replace them all with the SBC’s local IP address
Save and import this config into the Patton gateway, reload, wait, and it should be visible to 3CX once loaded & connected behind the SBC.
LG-NORTEL iPECS-300 Maintenance Password Reset
Connect to the PBX using a 9-pin female to 9-pin female serial console cable.
Use Putty or similar to console in with 115200,8,N,1
Press Enter to initialise the console
Password to enter console mode is: jannie
Reset the maintenance password using:
password man <your new maint password here>
Now you should be able to login to the web interface using the maintenance account and the password set on the end of the terminal command.
Extra notes: https://www.tek-tips.com/viewthread.cfm?qid=1783908
3CX Monitoring in PRTG
This script is designed for Debian Linux based 3CX deployments that need to be monitored in PRTG.
Create the scripts in
/var/prtg/scripts
Call the script: 3cxstatuscheck.pl
Make it executable:
chmod +x 3cxstatuscheck.pl
Edit using nano:
#!/usr/bin/perl
#
#
#Script which checks several things on a linux box and then reports back to PRTG
#
$message = "3CX DNS resolve services and logfile OK ";
$status = "0";
@services = ("3CXAudioProvider01","3CXCfgServ01","3CXEventNotificationManager","3CXIVR01","3CXMediaServer","3CXPhoneSystem01","3CXPhoneSystemMC01","3CXQueueManager01","3CXSystemService01","3CXTunnel01");
# Get information from PING about DNS lookupability
open(DNS, "nslookup www.cisco.com|");
@dnsout = <DNS>;
close(DNS);
if ($dnsout[3] =~ m/can't find/)
{
$message = "Unable to resolve DNS";
$status = "1";
}
#check all of the services
foreach $service (@services)
{
open(SERVICECHK, "systemctl status $service|");
@servicestatus = <SERVICECHK>;
close(SERVICECHK);
# print "\n $servicestatus[2] \n";
if ($servicestatus[2] =~ m/running/)
{
#this service is active
}
else
{
#something is wrong with this service
$status = "1";
$message = "One or more 3CX services currently not running";
}
}
#check the end of the log file
open(LOGCHK, "tail -n 500 /var/lib/3cxpbx/Data/Logs/3CXMediaServer* |grep Error|");
@logstatus = <LOGCHK>;
close(LOGCHK);
if ($logstatus[3] =~ m/Error/)
{
#something is wrong with this service
$status = "1";
$message = "3CX Logfile contains many recent errors";
}
if ($status eq '0')
{
print "0:0:3CX OK: $message";
}
else
{
print "2:2:3CX DEGRADED: $message";
}
Add to PRTG as an SSH script sensor.




