Typeperf – Windows Command Line Monitoring Tools

typeperf is a good tools for Windows IT Professional to monitoring their server/PC through command prompt instead of GUI interface.

To understand more on typeperf, simply type in typeperf /?

To get all of the counter that can be listed in typeperf, you may enter the following command,

C:\> typeperf –q > c:\counter.txt

To define a counter live from your PC,

C:\> typeperf "\processor(*)\% Processor Time"

If you prefer to get from remote server,

C:\> typeperf "\processor(*)\% Processor Time" -s mickgenie.localhost

 

Tasklist & Taskkill

As a system administrator, tasklist and taskkill are very important where you could manage them easily from a remote server without access to the remote desktop.

Sometimes, you might suffer from a server highload, you may list the process task list from tasklist from another server,

tasklist /s system /u username /p password

Eg. tasklist /s myserver /u administrator /p mypassword

Next, you may perform a task killing from the taskkill command.

taskkill /f /im process /s system

Eg, taskkill /f /im php-cgi.exe /s myserver

Result:
SUCCESS: The process “php-cgi.exe” with PID 4020 has been terminated.

Linux Shell Script to backup MySQL database to remote server

Database is the most important file other than web file, hence the backup is very important for the web developer and web owner.

By referring to the current post, you may backup your database automatically from your Linux box.

###START###

#!/bin/bash

# Specify the temporary backup directory
BKUPDIR=”/home/mickgenie/tmp”

# Database Name
dbname=”dbname_here”
dbuser=”user_here”
dbpasswd=”password_here”

# store the current date
date=`date ‘+%Y-%m-%d’`

# Specify Ftp details
ftpserver=”FtpServerIP”
ftpuser=”username”
ftppass=”password”

# Dump the mysql database with the current date and compress it.
/usr/bin/mysqldump -u$dbuser -p$dbpasswd $dbname | gzip > $BKUPDIR/$date.$dbname.sql.gz

# Change directory to the backup directory
cd $BKUPDIR

# Upload the backup
ftp -n $ftpserver <<!EOF!
user $ftpuser $ftppass
binary
prompt
mput *.sql.gz
quit
!EOF!

# Remove the local backup file
/bin/rm -f /$BKUPDIR/$date.$dbname.sql.gz

###END###

With the above script, you may save it as file.sh and just schedule a cronjob to run it as your needed time.

Restore MySQL database with MySQLdump

MySQL database is one of the famous database engine used from the IT world.

To you might have a question such as how to move the current hosted database to another server? Actually it is very easy through the command line.

You may refer to the step as below to restore your database file.

Restore database with password.

mysql -h [remote_IP] -u [username] -p [password] [database_name] < [database_name].sql

Restore database without password

mysql -h [remote_IP] -u [username] [database_name] < [database_name].sql

Restore database from the remote server(you’ve logged into the server that wish to restore database)

mysql -u [username] [database_name] < [database_name].sql

Schedule backup for MSSQL to remote computer

If you familiar with MSSQL maintenance plan and ever configured backup through this tool and you should know that to backup the MSSQL database to remote computer, you have to configure Log On setting from services.

Okay, today we assume that we couldn’t allow to change the setting from Log On setting and wish to set the schedule backup, we could use maintenance tool and batch command to schedule it.

Firstly, create a maintenance plan from MSSQL, then select “Back Up Database Task”. From Database(s) option, select your database name, you may specify the directory that wish to backup. From this article we make it to C:\mssql\backup\.

Next, create a batch file named mssql_backup.bat and insert command as below.

xcopy C:\mssql\backup "\\remote_server\c$\backup" /e /i /h /y

Where remote_server is your remote server name and you would like to place it to C:\backup.

Lastly, create Windows Task Scheduler and configure the mssql_backup.bat to run daily or weekly as your wish.

Lowest Numbered MX Record Points to localhost

If you are using cPanel server and you might get this error from your exim_mainlog very often whenever sending and receiving email.

temporarily rejected RCPT <[email protected]>: lowest numbered MX record points to localhost

The reason of this error message is the domain.com is missing from either the /etc/localdomains file or /etc/remotedomains file. The difference between two of these file is that, they decide whether the email has to be delivered locally or through a remote server by the exim email services.

To get it fix, add your domain.com to /etc/localdomains file to last line(new line each domain).