Now Playing Live Example
Now Playing HTML Code
<iframe src="http://http://199.58.163.11/rr/now_playing.php" width="325"></iframe>
After doing a WHM multi-account copy, you may want to refresh the users home directories (including email and web files). This one liner uses rsync over SSH to do a quick sync of only changed files, emails, and website files. Run these commands on the NEW server.
First you need to create a list of domains in a text file ‘domains.txt’. Replace 1.2.3.4 with the remote hostname or IP.
while read i ; do rsync -aHxv root@1.2.3.4:/home/$(/scripts/whoowns $i)/ /home/$(/scripts/whoowns $i) ; done < domains.txt
Alternatively, you can use a list of users instead of domain names (use this method if there are multiple domains per user):
while read i ; do rsync -aHxv root@1.2.3.4:/home/$i/ /home/$i ; done < users.txt
After you do a WHM multi-site transfer, you may want to resync all the MySQL databases before doing a DNS change. Here’s a quick and easy way to sync each Cpanel user’s databases on the new Cpanel server. After manually setting up a remote mysql root user on the original server (and opening a firewall port if needed), run this command on the NEW server.
cat /var/cpanel/databases/dbindex.db | grep -E ': .+' | awk '{FS=": ";print $1}' |[ \t]+|:)/, "")};1' | xargs -L 1 /root/sync_db.sh <remote_host> <remote_root_pass>
If you only want to sync (or resync) one or two databases, you can copy /var/cpanel/databases/dbindex.db to a different location and edit it as needed.
Here’s the bash sync script required for this command:
The visual diagrams still confuse me after so many years and I always forget…so here it is:
INNER JOIN gets all records from one table that have some related entry in a second table
LEFT JOIN gets all records from the LEFT linked table but if you have selected some columns from the RIGHT table, if there is no related records, these columns will contain NULL
RIGHT JOIN is like the above but gets all records in the RIGHT table
FULL JOIN gets all records from both tables and puts NULL in the columns where related records do not exist in the opposite table
If /etc/fstab is correct, you can simply type:
# mount -n -o remount /
If /etc/fstab is wrong, you must give the device name and possibly the
type, too: e.g.
# mount -n -o remount -t ext4 /dev/sda3 /
Monitor the status:
crm_mon
Migrate all resources to another node:
crm resource migrate rg_main <fqdn_node_name>
Take node offline and online (be careful, this sets a ‘prefer’ to the other node to force a transition, which may or may not get removed afterwards):
crm node standby
crm node online
Start and stop all resources (warning, this will take them completely offline, NOT migrate):
crm resource stop rg_main
crm resource start rg_main
Show configuration:
crm configure show
If resources are stuck in ‘(unmanaged) FAILED’ state, e.g. due to a failed stop action, you can clear it out:
crm_resource -P
crm resource cleanup rg_main
Be careful — this could trigger a migration if the stuck resources were preventing one. Make sure you’re ready for one.
Monitor the cluster status along with fail counts:
crm_mon --failcount
One-shot status output:
crm status
Check DRBD status:
cat /proc/drbd
DRBD split-brain cleanup on secondary node:
drbdadm disconnect main
drbdadm -- --discard-my-data connect main
DRBD split-brain cleanup on primary node:
drbdadm disconnect main
drbdadm primary main
drbdadm connect main
Scheduler optimizing on large arrays (untested):
echo deadline > /sys/block/sdb/queue/scheduler
echo 0 > /sys/block/sdb/queue/iosched/front_merges
echo 150 > /sys/block/sdb/queue/iosched/read_expire
echo 1500 > /sys/block/sdb/queue/iosched/write_expire
Enable mail relaying from a specific IP or range of IPs.
1. Exchange Management Console -> Server Configuration -> Hub Transport
2. New Receive Connector
* Set remote network to the IP or range you want to allow relay from (default is any IP so watch out here)
* “Externally Secured” authentication
* “Exchange Servers” permission group
* All other options disabled
If a (poorly coded) app reaches the maximum number of files or folders per directory in Linux, you may see errors like this:
Error happened when generating Download Link.
Please try again or Contact administrator.
(ERROR:mkdir)
A quick and dirty way to increase the limit (and overall performance of the system) is to add the dir_index flag to the ext filesystem, then reindex:
tune2fs -O dir_index /dev/sda3
updatedb &
This will set the ‘ADMIN’ user password back to default of ‘ADMIN’. You could set it to anything you want, this is just an example.
yum -y install ipmitool
modprobe ipmi_devintf
ipmitool -I open user set password 2 ADMIN
Don’t try to reinvent a complex and highly refined wheel, especially when customer data is involved. Please use phpass on any PHP project. (that’s PH-Pass)
http://www.openwall.com/phpass/
Good reading for password hashing in general.