Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Tuesday, January 12, 2016

I catch some flack sometimes. Mostly when I forget to do what I say I would. Today I'm making good on a 9 month old promise to you, the reader. This is how to have {as much hard drive space as your computer's body has room for} space for RetroPie and the Raspberry Pi for you, the Windows user.
I had my hot wife help me with this one. She knows more about Doze stuff than I do. I've been out of the Windows game at home at at work for years now. Special thanks to her for the screenshots.

Step 1: Create a Directory

Put it on the drive where you will store the juicy payload for the Pi.
For illustration purposes, a Documents folder will do. Probably not for you though


Step 2: Copy roms/BIOS or other folders (RetroPie only)

In your Explorer sidebar, click network and root around a bit until you find your Raspberry Pi. Find the roms and other directories that are shared by the Pi and copy the contents to the directory created in Step 1.
Dem Games
It's important to note that if you want to do this with more than one directory that is already on the Pi, you will have to repeat steps 1 and 2 as many times as you have folders you want to share from your bad ass rig.


Step 3: Delete the contents of the folders on the Pi

This might be painful if you have quite the collection of games and sundries. Relax. You just backed them up in Step 2. Should anything go sideways, you can always restore!

Go back to that network share you copied all the stuff from in Step 2 and delete EVERYTHING. This is important as future steps will not work without the directory being absolutely devoid of anything resembling a file.
Oh Damn! She got Zork!

Step 4: Share your badass file source

Let's take a minute and disclaim that this is what is considered by the paranoid who don't want their links to pornhub or /r/gonewild exposed on the interwebs to be insane or insecure. I beg to differ as far as the paranoia goes in terms of network security. This tutorial is just for a simple share.
Right click the folder you created in Step 1 -> Sharing
For least possible sadness and greatest possible happiness, select the "Everyone" user to share with.
Everyone is getting into my private stash now


It's important to give the "Everyone" user Read/Write access if you want things to be saved like game state, configs, or other important things.

Step 5: Save share and take note of the directory

That greyed-out mess is important
In this example, everything after \\LADY-PC\ is relevant. Be sure to copy it to something or leave the confirmation window open for reference.


Step 6: Acquire Software on the Pi

Uhhhh wait.. who is writing this? The Pi already has everything ready to go for this with Windows. Take a break. Have a beer and a smoke if you're inclined and enjoy what you've accomplished so far.

Step 7: Configure the Pi to map the share

This step is the same as the most previous post with some variation. SSH into the Pi and open /etc/fstab in an editor of your choice (nano, vi, vim, emacs, your choice). Open with sudo for least possible rage.

Add a new line with something like


//HostIPAddress/Path/To/Your/Share /place/to/share/on/pi cifs guest,uid=1000,gid=1000,iocharset=utf8 0 0
Parts in red are pretty much mandatory for this sort of open setup. Parts in black are up to you and what you want to do with it. Replace spaces with \040 since you use Windows and can't help but put spaces in directory paths. This is your punishment.

Save and quit your editor.

Step 8: mount -a

Put "sudo mount -a" in the console and hit enter. If it doesn't bitch at you, congrats, you win. Type in "sudo init 6" for a restart and you should be off to the races!


Thursday, October 7, 2010

*EDIT: To see a version that doesn't suck, click here*
I could not find a ready-made module for monitoring my KMS server with Nagios. All I wanted to know was what the current count of activations handed out by the server.

On the KMS Server

First off, some jury rigging. You have to set up a shared folder on your KMS server. In my case it was C:\nagios.

Next, create a batch file (kms_status.bat) with the following line:
cscript C:\windows\system32\slmgr.vbs -dli > C:\nagios\kms_status.txt

Next, set kms_status.bat to run as a scheduled task. I set it to run every hour. You can set it to whatever frequency you want.

On the Nagios Server

First, because I'm lazy, I added the following to rc.local instead of editing fstab in order to mount the Windows share from the KMS server.
mount -t cifs //[KMSSERVERADDRESS]/[SHARENAME] /media/net -o domain=[DOMAIN],username=[USERNAME],password=[PASSWORD]

Next, create a file called check_kms in /usr/local/nagios/bin and copy/paste the following code into it.
#!/bin/bash

COUNT=`grep -i "count" /media/net/kms_status.txt | awk '{print $3}' | tr '\r' ' '`

if [ $COUNT -le 24 ]
then
      echo "CRITICAL: Current Count: "$COUNT". The count is too low for KMS to work."
     exit 2
elif [ $COUNT -ge 25 ]
then     echo "OK: Current Count: "$COUNT". You can go have another cup of coffee now."
     exit 0
else
     echo "UNKNOWN: Something is wrong. kms_status.txt might not be available."
     exit 3
fi


You'll have to chmod +x check_kms

Add the following to /usr/local/nagios/etc/objects/commands.
define command{
     command_name check_kms
     command_line ./usr/local/nagios/bin/check_kms
}


The last thing you have to do is go to the configuration for your KMS server in Nagios and add the following.
define service{
     use generic-service
      host_name [KMS SERVER NAME]
      service_description KMS
     check_command check_kms
}


Lastly, restart Nagios. For Ubuntu users: /etc/init.d/nagios restart

If all goes according to plan, you should be up and running and should look like this.
Subscribe to RSS Feed Follow me on Twitter!