Monthly Archives: April 2014

cPanel account transfer on command line

Login your Old server SSH via root user and use these commands.

root@OLD[~]#cd /home
root@OLD[~]#/scripts/pkgacct

Once package account process completed, You can view backup file like cpmove-cpuser.tar.gz

Transfer account to another NEW server using RSYNC or SCP commands.

root@OLD[~]#rsync -avz –progress /home/cpmove-cpuser.tar.gz root@:/home

User this command if your server have different SSH port.

root@OLD[~]#rsync –progress –stats -avz –rsh=’ssh -p5093′ cpmove-user.tar.gz root@:/home/

Once transfer completed goto NEW server SSH and restore account.

root@NEW[~]#/scripts/restorepkg oldcpuser

centos dmesg timestamps

vi /root/.bashrc

dmesg_with_human_timestamps () {
$(type -P dmesg) "$@" | perl -w -e 'use strict;
my ($uptime) = do { local @ARGV="/proc/uptime";<>}; ($uptime) = ($uptime =~ /^(\d+)\./);
foreach my $line (<>) {
printf( ($line=~/^\[\s*(\d+)\.\d+\](.+)/) ? ( "[%s]%s\n", scalar localtime(time - $uptime + $1), $2 ) : $line )
}'
}

alias dmesg=dmesg_with_human_timestamps

stdin: is not a tty

When you are connecting to a remote server using ssh (for rsync, or other remote functions), and are receiving ‘stdin: is not a tty’ error messages in your log files, it is most likely because your remote shell is trying to execute something which needs to run interactively, when you are not in an interactive mode.

Simply add the following line to the top of your .bashrc:

[ -z "$PS1" ] && return

This will cause bash to check and see if it is running interactively or not, and if it is not, it will halt processing of the configuration file, preventing the rest of the file from executing code which could possibly generate this error when in non-interactive mode.

tty vs pty

A tty is a native terminal device, the backend is either hardware or kernel emulated.

A pty (pseudo terminal device) is a terminal device which is emulated by an other program (example: xterm, screen, or ssh are such programs). A pts is the slave part of a pty.