Tag Archives: Windows

Rebootolator: Execute a Remote Linux Shell Script from Windows

Ok,  so, your mission, should you decide to accept it, is to restart mySQL and Apache on a remote server. This restarts a balky web site hosted by Apache, and also restarts a mySQL server which is used for a back-end for Drupal.

You want to execute this from your Windows computer.

The target computer runs CentOS 5.6 This is an (ancient) Red Hat Linux derivative, running (ancient) mySQL and Apache.

I ended up using PLink called from a Windows .CMD file to execute a bash shell script.  The shell script looks like this:

Rebootolator

#!/bin/bash -p
# Rebootolator – Reboots Apache and mySQL on a target Server
# LK Microdesign June 25, 2014
TERM=”xterm”
export TERM
clear
echo
echo ‘Rebooting Apache and mySQL on myServer’
echo ‘———————————–‘
echo ‘Restarting mySQL’
/etc/init.d/httpd restart
echo ”
echo ‘Restarting the Apache web server.’
/etc/init.d/mysqld restart
echo ‘Reboot procedure completed’


Note this script is not stored on the target server, but simply put in the same folder as the windows cmd file on my windows box.  

Now for the Windows command file: 

Reboot.CMD

:: Batch file to restart services on myServer
:: Restarts mySQL and httpd 
:: Uses the Rebootolator shell script
:: LK/Microdesign August 12, 2014  
@echo off
cls
echo. 
echo.
plink -ssh username@192.168.xxx.xxx -m rebootolator.sh -pw mypass
echo.
echo.

pause >nul | echo Press any key to exit. 

So, lets deconstruct the Windows Reboot.CMD file.
The first four lines are comment lines. Turns out, you can use two colons to preface a comment in Windows, (who knew?) instead of REM.
Line 5 turns off output to the screen.
Line 6 clears the screen.
Line 7 and 8 put in blank lines.
All the work happens on line 9, using the PLINK command. PLINK is the command line version of PUTTY, a free open source terminal program for Windows workstations. Both PLINK and PUTTY are pretty wonderful and highly recommended if you need to access Linux machines from Windows.
-ssh means “use the secure socket layer protocol to log into this machine”
username@192.168.xxx.xxx is a administrator’s account on the target machine,  probably the root account.
-m rebootolator.sh is the name of the shell script (above) that needs to run on the target machine.
-pw mypass is the password for the account used to log into the machine.

Deconstructing the Rebootolator.sh script:
#!/bin/bash -p  just means this is a BASH script
The two commands that actually restart the mySQL server, and the Apache server are: 
/etc/init.d/httpd restart
/etc/init.d/mysqld restart

The rest, (the echo commands) write out what  is happening at the command line. The Term command is my attempt to avoid a harmless error message that occurs when the script starts to execute.

Since I didn’t realize I could host the Rebootolator.sh script in my Windows folder, I originally though I’d have to log into one Linux box, and then execute the script on the target box.  Turned out the whole thing was simpler using PLINK, which is the equivalent of SSH and SSHPASS programs used to access remote machines from the Linux command line.

Alabama Eye Bank runs on FileMaker Pro.

Over at  Tech for Home Healtcare,  I’ve described how the Alabama Eye Bank uses FileMaker Pro to manage the process of receiving donated corneas thorough finding a recipient and scheduling the surgery. It is an amazing application that shows the cross-platform versatility of FileMaker, hosted on Windows servers, and deployed to Mac workstations, iPads, and iPhones.  

Refurbished Desktop Computers

Refurbs are for when you have more time than money. I’m not sure about the exact figure, but in many cases, I think I’ve ended up spending several hours per unit getting a refurbished computer back online after a hard drive failure, or just having to spend hours updating Windows and Office so that I’m confident getting the machine on the network.

We got several “really good deals” from NewEgg, for refurbished Lenovo desktop computers at $214.00. These appeared to be of “office quality”, included Windows 7 Pro, and were nicely finished. Unfortunately, we have had 2/3 of the Western Digital Blue hard drives start to fail at some point. This has created no end of extra heartache for the users and an enormous amount of work for the IT staff.

NewEgg has been fine on returns, however, providing UPS shipping labels, and RMA procedures over the web.

OK….so much for NewEgg.  We’re looking at alternatives.  (we have more time than money).

Techsoup has Dell refurbished computers that are prepared by a third party. For example:


Dell OptiPlex 755 Core 2 Duo Windows 7 Desktop 2.0 Ghz – 2.6 Ghz 
$286.00 
Min of 160Gb drive
Min of 2Gs RAM 
Windows 7 Professional 64 bit. 
Also includes: 
Office 2010
Adobe Flash,Reader 

One advantage here is that if you need licenses for Windows 7 and Office, they are included in the price. You would spend the $286.00 on those if you bought at retail, and maybe quite a lot less if you have a Microsoft Open, agreement. But, it like getting the hardware free.

The Dell Outlet looks promising with several machines in the $315-$390 range which still include Windows 7 as opposed to Windows 8, and have at least 500Gb drives, and 4 Gigs of RAM. These have more up-to-date processors than the Techsoup machines, and are certainly not as old. Most Dell Outlet machines were either not delivered, or were taken back within the warrenty period.

I’ve had solid results with Dell Outlet computers at the workstation and server level; mixed results with standard desktop machines, and a real disaster with older SX-series Optiplexes.  The best seem to be the larger ones; towers or mini-towers. Smaller machines, “mini-desktops” may have suffer from the suboptimal cooling, and the older components may have reached their design end-of-life earlier than those installed in a larger case.

One thing we have often found is that dual monitors are wonderful, and this is something that I would recommend for anyone as a matter of course. If you need an extra monitor card, these can be found from NewEgg starting at around $35.00. Best to wait until you have received the machine, because there can be variations in the slots, and the available adapter space that aren’t evident from the web page.

On the Mac side, I’ve purchased several Macbooks, iPods, iPads, from the Apple Store. These have always worked flawlessly. The Refurb store has a 21.5 inch iMac for $1099, which is the model from September 2013. The cost is only $200 or so less that of a new, similar iMac. It includes 8 gigs of RAM, and 1 terabyte hard drive, and of course the Mavrick OS, and iWork. If you’ve got more money than time, and just want to get to work, this might be the way to go.

Microsoft Small Business Server 2011 — Install Quirks

Well, maybe not quirks exactly, but, there do seem to be a few points of interest.

To review, Microsoft Small Business Server 2011 is a bundled combination of the following:

Windows Server 2008
Microsoft Exchange 2010
Microsoft SharePoint 2010
Microsoft SQL Server 2008

In its usual confusing way, Microsoft can’t offer a single version of this but rather, they have three editions. There is Windows Small Business Server Standard (with the software described above), Windows Small Business Server Essentials (which substitutes cloud versions of SharePoint and Exchange for the bundled server versions that come with Standard). There is also an supplementary Small Business Server Premium Add-On which adds another SQL-Server box for running back-end database applications or web sites. I’ve been working with Standard. This can serve a maximum of 75 users, which I’m sort of assuming means 75 currently connected users, and that you could configure more than that number.

On installation, the SBS server wants to be a DNS server as well as a DHCP server. It is helpful to have the server connected on the LAN, with a working internet connection. If, as in my case, you run a separate DHCP server (the box which doles out IP addresses for workstations as they come online), then you need to disable it temporarily while setting up the SBS machine. Otherwise, SBS will complain and fail to configure its connections to the internet.

Another quirk is that when you first install the operating system everything is installed on drive C: including users shares, Sharepoint folders and Exchange mailboxes. Presumably you’ll want these to reside on a separate set of disks, or partition from the O/S partition, and there is a series of “wizards” that allow you to accomplish this without pain. Once the folders are moved to the data drive or partition, the default new user folders are created in the correct location.

The SBS server must be the top level domain controller in a Windows network. Other Windows servers can be secondary domain controllers but not primary. There is an elaborate multi-page migration methodology which is supposed to allow you to migrate users for SBS 2003 to SBS 2011, however much of the discussion on the technical boards suggests that the migration is a nightmare. So, in the two instances that I’ve been upgrading, I’m starting from scratch. I don’t went to be caught in the middle where the old installation isn’t working and the new one isn’t ready for some unknown or odd reason.

I’m still on the fence as to whether SBS is a good idea. If you’ve already got a POP eMail server going, which has Spam filtering and all the standard features provided by an ISP, managing Exchange on a local server just seems to me to provide an opportunity for additional work and maintenance. It also places all critical applications on a single piece of hardware. On the other hand, Exchange has evolved as a pretty nice calendaring and eMail server, and SharePoint, for those who can use it, works well as an internal knowledge base. SBS includes other tricks, like VPN capability, OutLook web access for accessing your OutLook mailbox from the web, and lots of management wizards which tend to ease some of the burden of maintaining things.

As a practical matter, servers are pretty reliable these days… and you have to go out of your way to practice and rehearse a disaster-recovery scenarios because they just don’t happen that often.

Spicy Server Pix

Shocking! Server Interior Revealed!

Click on the images to see them full size.

Here’s a picture of my new Dell T110 server, with the cover off.

Here’s a little more detail. You can see the two drives mounted on the left hand side, with two conveniently vacant drive bays for a couple additional SATA drives. Upper middle are the four memory slots, each filled with a 2 megabyte chip for a total of eight megabytes. All the black stuff on the right is the shroud covering the heat sink. The unit is absolutely silent.

Finally, here it is in the final configuration. I’ve got an older Maxell external USB 250 megabyte drive as a backup device. The Small Business Server 2011 backup is much improved over Windows backup software that came with earlier Windows server software…almost as good as the Mac Time Machine.

This is the first purpose-bought server that I’ve bought in more than ten years for my business. I had a couple in the nineties. Then for two or three iterations, I’d buy Dell Precision workstations to use as my personal workstation, and then I’d bump them down to be a server. All of these machines have been very reliable. I even used one of the Optiplex GX270 desktops as a production server for more than six months.

Tech Friday: More on Windows Small Business Server 2011

So, after fiddling for a week, I decided to commit, and make the SBS 2011 my real office server, at least for awhile. Amazing how much tweaking is required. Out of the box it doesn’t work out of the box, and despite the presence of numerous wizards and checklists, I find that it requires a fair amount of network knowledge to get things up and running. Ideas:

1. Under the covers, SBS 2011 uses Windows Server 2008, and Microsoft Exchange 2010.

2. In its default state, SBS assumes it will control everything, even unto DHCP. DHCP is usually enabled by default on most routers. It is the function that assigns an internal IP address to each workstation as it comes on the network. I prefer that the function stay with the router, so if the server is off for some reason, workstations can still get a legal IP address to be able to go out on to the internet. For the moment, I’ve acquiesced and given that function to SBS.

3. Since I’m planning to run Exchange, I needed to have a domain assigned to my SBS server. I have a fixed outward facing IP address from Comcast, my internet service provider. I assigned a “third level domain name” to my SBS server. This is often done for individual machines within a domain. So, for example of your company’s domain is kettleprises.com, you mail server might be mail.kettleprises.com, and your sbs server might be sbs.kettleprises.com. Third level domain names do not usually cost extra. I then configured a DNS server on the SBS box using the assigned third-level domain. So far, I haven’t been able to find my domain mapping using nslookup, so I’m a little worried that something is awry.

4. The above is not to be confused with the “windows domain”, which is a single name for the local area network’s SBS machine. I named mine ghq. SBS then translates this to ghq.local which is assigned to the server’s internal ip address.

5. The next issue, is to get the network workstations connected to the server. Before doing that, the help file suggests creating the user accounts on the server. Once you do that, you can go to the individual workstations, and run the web browser, and try to find http://connect. If this is successful, then you’ll see the following screen:

This is only a link to download a “launcher.exe” file which is a script which connects the computer to the network. If there are local user profiles available, it allows you to choose one to migrate to a domain account. (Again, showing essentially that the SBS developers assume that this is the first server of a one-server network, and you would only be migrating local workstation accounts to domain accounts anyway.)

If you can’t bring up the web page, then something is misconfigured, somewhere. It took me several tries to make sure everything was working as expected. I thought the last loose end was the fact that my third level domain name hadn’t propagated yet, but between the time I started writing and the time I’ve finished, it now appears under NSLOOKUP.

Laplink PC Mover migrates Windows Users to new machines

Moving users to new Windows machines is a pain. PC Mover helps automate the process, and it even assists when you are migrating users between Windows versions, such as upgrades from Windows XP to Windows 7.

Despite being lead to believe otherwise, PC Mover does not fully migrate OutLook accounts. Rather it will migrate the account server connection but it does not migrate the OutLook messages. I confirmed this with their technical support people.

You can migrate messages by copying the OutLook.PST file from the old machine to the new machine. I found I had to do this each time I migrated a user from Windows XP to Windows 7 on a new machine. Everything else, however, migrates smoothly. To do this:

1. Make sure the new machine is connected to the network.
2. If you can (or need to) register the computer with the Microsoft Domain Controller (under Control Panel, go to System ->Computer Name, and see that the computer is a member of the domain.
3. Log in to the new computer with the target user’s domain account. This will create a new user profile on the new computer.
4. Log off, and log in again as the Domain Administrator. This will give you rights to perform the migration on the new computer.
5. Install and run PC Mover on the new computer.
6. Log in as an administrator on the old computer.
7. Install PC Mover on the old computer. (I use a thumb drive for this).
8. Run PC Mover on the old computer. It will find the new computer on the network .
9. Choose the user’s domain account on the old computer for migration to the new computer. (This is the reason for step 3 above. Before doing this, I received an error message from PC Mover on the old computer saying that it can’t migrate the domain account. I’m presuming that is because the account didn’t exist on the new computer.)
10. In general, you don’t want to migrate old versions of applications that won’t be used on the new machine. So, these being Dells, I didn’t migrate things like Roxio CD Creator from the old machine to the new one. Also, if you already have applications installed (Office 2007?) on the new machine, you don’t need to migrate the whole application again.

One thing that is helpful is there is a rollback function, so if the migration doesn’t work as expected, you can roll back and try again with different settings.