RSSAll Entries in the "Server Management" Category

Log off user in Windows

This will be a quick one. There was inquiry from one of our visitors how to log off remote users on Windows server, and I will provide a quick example.

To have a view on the currently logged users, the best way will be trough the Task Manager. To open it remotely just right click on the Windows Task Bar.

Right click Windows Taskbar

Once the Task Manager is opened, click on the Users tab and you will find a list of the currently logged users.

Taks Manager currenlt logged users

Right-click and log off Windows user according to your needs.

Log off Windows user remotely.

You can log off remote user as well as the local ones.

Host multiple domains on one hosting – cheating the hosting companies.

I barely remember my first site and how it was created, but I still remember the filling when I saw the price for the webhosting I was searching for. Then I was a student and if I wanted to see my website live, I had to pay one third of my monthly budget. That was before more than ten years and the webhosting was pretty expensive than now.

Nowadays the hosting prices are way to low, but if you are familiar with webhosting and understand the services that some hosting companies provide – you probably know that even price of couple of bugs is too much for what you actually get. I am not going to fail into detailed discussion about hosting companies, plans etc.- so if you are at the point where you do not have much to spend on webhosting, and in the same time you want to start building websites and host them cheep you may use the method described bellow.

Lets consider the following case:
You have bought webhosting which include something like this:
One domain hosted, 160GB drive space, MySQL database, PHP, any-other-marketing-bla-bla . (For Windows hosting users, please read Redirect domain alias to a particular folder in Windows)

Certainly the main point here is that you have pretty much space, PHP and MySQL which allows you to do almost everything, and .. just one domain hosted. Here I have to say that the whole freetutorialssubmit.com website is not more than 600MB and if I decide to host it on such hosting, the rest of the 160GB space will remain unused. You may decide to use the rest of the space as a storage, but in most cases it just remain like that.

With the PHP script bellow you can host multiple domains on one hosting even it the hosting company allows only one domain to be hosted, which will allow you to use the rest of the hosting space for different websites.

Before that I have to mention that all domain you want hosted in this hosting should be set like CNAME for the main domain. The reason is that when a domain is set as a A CNAME record or Canonical Name record in the Domain Name System (DNS) – this specifies that the domain name is an alias of the other domain. This is rather simple and can be done in with the company where the domain is registered for free. (If not try GoDaddy ;)

Once a domain is set as CNAME it will do exactly the same as the first domain. Here comes my script which basically check as which domain the browser request is done and redirects to a particular folder where the according domain files are set. The script should be in the main index.php file, otherwise it will not be opened and will not redirect accordingly.

Ok, it may looks confusing, but what is actually happening is when someone lands on your hosting, his browser opens the main index file. The script checks ‘HTTP_HOST’ global PHP variable which contains actually via which domain the server was reached and then redirects to its index (you can see it in the example as index2.php and index1.php ), or to a particular folder. If there is no match the visitor’s browser will stay in the same file and will continue with the main domain code.

Well that’s it … and yes, it is legal to host multiple domains on one hosting using this way!

301 redirect checker script

This tutorial contains 301 redirect checker script which I have created after spending more than half an hour searching the Internet for something suitable I can use for my needs. While I was searching I found only separate web pages with fields where you can check one – two URLs or heavy applications that can be installed, and yet not covering my needs. Certainly, there were paid 301 redirect checker solutions which can be used to check 301 Permanent Redirect, but I am not sure whether it does worth to buy such. The purpose of this checker in most cases is only to see if a particular pages redirect permanent covering the SEO (Search Engine Optimization) requirements.

In my case part of the OnlineHowTo.net is moving over Free Tutorials Submit dot com, and from SEO perspective, the tutorials moved have to be with 301 redirect to their new URLs.

I decided to write it as Linux bash 301 redirect checker script because it can be run on almost any Linux machine with curl installed and easily added to the Crontab. I believe the script is rather easy to be understood and used, even by not so experienced administrators.

What the redirect script is doing is to gather the URLs you want to check from an external file (in my case: /opt/scripts/301URLs.txt ), where every URL is placed on a separate line like this:

I chose this way as most of the get-all-urls-from-domain applications provide the listing like this, but certainly you can choose (and then modify a little bit my script) different format.
Then using simple bash loop it reads every line one by one, processing it with CURL extracting the headers (curl -I option).
Every header contains information similar to:

Once we have this information we can easily egrep for the 301 Moved Permanently part and if it exist, the 301 redirect checker script continues with the next URL. If the redirect is something different it writes down the URL into the /tmp/301report.txt file.

Finally the script checks whether the /tmp/301report.txt file exist – it will be created only if there is even one different from 301 Moved Permanently redirect – and will send it via e-mail to the address you have set in the EMAIL variable. If there are no such file, the script will end with no report.

Here is the whole script which you can freely use and modify as per your needs:

 

To be honest, I am using a little bit modified 301 redirect checker script, which is also checking whether the redirected URL is the one I need, but it is more complicated and may confuse you if you have to modify it.
Also, more elegant solution will be if you decide to use array, but this redirect checker script fits my needs perfect.
Also I have put sleep command as if the number of the URLs is too big, it may lead to server abuse and blocking the IP you are checking the redirect from. If you do not need the script to wait 5 seconds for every URL, just remove that line.

Hope this scrip will cover your needs as well. Your comments and suggestions are welcome.

Tags

How to restore lost Plesk password on Unix – Linux server

This tutorial will show you how to gather your Plesk control panel password in cases when it is lost or has been forgotten.
It is written for Plesks installed on Unix/Linux based servers.

1.Login to your server via SSH and make sure you are switched to root.
2.In the console type:

 

Then you will see the current password for the ”admin” account.

Since Plesk 10.2 the password in .psa.shadow file is encrypted and can be shown as plain text using:

Tags

Restore MS SQL database backup on a server

This tutorial will show you how to restore MS SQL database a backup on a new server.

I presume you have backup file already. (If you do not have one and you can backup on the old server with right-click on the database inside MS SQL Management Studio and then ‘Backup‘)

So, you have moved the backup file on the new server, and now we have to create a database where the backup will be restored.
Login to the MS SQL server expand ‘Databases’ section right-click and choose ‘New Database’.

Tags

Create MS SQL Maintenance Cleanup Task

This is the fourth part of MS SQL backup maintenance plan tutorial, and continues from Create MS SQL Shrink Databases Task one.

In this tutorial we will discuss how to create and setup Maintenance Cleanup Task in MS SQL for outdated database backups and transaction logs.

The Maintenance Cleanup task removes files related to maintenance plans, including database backup files and reports created by maintenance plans.

By using the Maintenance Cleanup task, a package can remove the backup files or maintenance plan reports on the specified server. The Maintenance Cleanup task includes an option to remove a specific file or remove a group of files in a folder. Optionally you can specify the extension of the files to delete.

I will create two cleanup tasks. Drag two Maintenance Cleanup tasks one for the databases and one for the transaction logs.

Tags

Create MS SQL Shrink Databases Task

This is the third part of MS SQL backup maintenance plan tutorial and continues from Create MS SQL Back Up Database Task.

Here we will discuss how to create and setup MS SQL Shrink Databases Task.

Each file within a database can be reduced to remove unused pages. Although the Database Engine will reuse space effectively, there are times when a file no longer needs to be as large as it once was; shrinking the file may then become necessary. Both data and transaction log files can be reduced, or shrunk.

The database files can be shrunk manually, either as a group or individually, or the database can be set to shrink automatically at specified intervals.

To add the ‘Shrink Databases Task’ drag it from the Maintenance Plan Tasks list, select it into the field, connect it with the arrow from the previous backup task, right-click on it and choose ‘Edit’.

Create MS SQL Back Up Database Task

This is the second part of MS SQL backup maintenance plan tutorial. Here we will discuss how to create and setup MS SQL Back Up Database Task.

In the previous tutorial we started with setting up time frame when the maintenance plan will run as well as the first important part to check the data base integrity, before starting the backup.

Now, the next option will be to create ‘Back Up Database Task‘ which allows you to specify the source databases, destination files, and overwrite options for a backup.

Tags

Create MS SQL Backup Maintenance Plan

Probably one of the worst things that can happen is to loose data especially a database which is dynamically changed. In this case if you do not have backup, you could loose money, time, nerves, etc.

With few step-by-step tutorials I will show you how to set backup maintenance plan in MS SQL.

I will use Microsoft SQL Server Management Studio, where in the management section I will set new maintenance plan which will create MS SQL backups on daily basis.

First open MS SQL Server Management Studio and expand the ‘Management’ section, then ‘Maintenance Plans’ section:

Tags

List all mail accounts in Plesk using MySQL command

You are small design company with several clients, you are server administrator, you are curious young person playing with Plesk database, you are owner of VPS or dedicated server – it does not matter – you need to view all mail accounts in Plesk. Then this tutorial is for you.
If you are experienced user probably your will use some MySQL commands or you will have PHP MyAdmin installation to understand and manage the Plesk database, but it in the same time you will land on this page if you need a hint how to see all mail accounts in Plesk.

Anyway. In order to list all email accounts in Plesk , first login to the server with user who has access to ‘MySQL’. Usually this is ‘root’, but depending on the setup of the server it could be different.
Connect to the Plesk database :

Tags