Wednesday, July 8, 2015

Split PDF Documents into unique named items on an element in the PDF

In schools you get a lot of reports that are provided in PDF format.  Each page is usually unique to each student in the district.

This year the student test results are provided in a PDF.  One file with ELA scores, and one file with Math scores.  To print the scores back to back we have to merge the two files with ELA and then Math for each student.

This software will split the PDF into a unique PDF file for each student.

http://www.a-pdf.com/content-splitter/index.htm

Then you merge that with the split Math PDF and you get one PDF with both ELA and Math.

I found this while working through the splitting process.  Lots of software can split a PDF document into unique pages, but I didn't find any at this price point that would split it and name it based on the content in the PDF.

Let me know what you think in the comments.

Wednesday, September 17, 2014

Remote Add Domain User to local Admin Group

I have a bunch of computers in classrooms and teachers like being able to install software on those computers...most of the time it is items that I would do myself if I had the time, but it is more convenient to have the staff do it for me since they want to use it.  Anyway, I found these instructions that add a user to the local administrators group.  I can run this remotely from my desk without having to get up and travel to the remote location.

I followed these instructions to do this, so I am not the one who figured this out, just want to make it easier for the next guy to find.

1. Get a copy of PSTools from Microsoft.
http://technet.microsoft.com/en-us/sysinternals/bb896649


2. Open a command prompt and run psexec.

  psexec.exe \\computername cmd.exe


3. Add the user.

  net localgroup administrators domain\user /add


That is all there is to it.  Have the user sign into the computer with their own credentials and they now have permissions to install on the computer.

Tuesday, August 12, 2014

Google Drive Sync as a Windows 2008 Service

We have a few Chromebooks being used by staff throughout the District.  We also use Windows shares heavily for access to shared files.

Access to Windows shares is not possible, but access to Google Drive shares is.  And Google offers a product called Google Drive Sync that will put files from a computer in Google Drive and keep them synced.

Now enter an awesome post: http://superuser.com/questions/463801/sync-google-drive-when-not-logged-in
Specifically the post from Reece Dodds.

That post is perfect, except for the registry information, but I missed the create subkey Parameters part, so I want to just make sure that everyone has an exact step by step guide.

  1. Log into the server with the account that you want to run the service as.
  2. Disable Internet EIC through Server Manager -> Configure IE ESC under the Security Information section on the main page.
  3. Setup Google Drive Sync. Configure google drive to not run at startup and exit the application.
    https://tools.google.com/dlpage/drive
  4. Download srvany.exe from Microsoft Windows 2003 Resource Kit. Copy srvany.exe into the folder where google drive is installed.
    http://www.microsoft.com/en-us/download/details.aspx?id=17657
  5. Open a windows cmd prompt (run as administrator) and type in the service and authentication details you want (in our case GoogleDriveSync) i.e. sc create GoogleDriveSync displayName= "Google Drive Service" start= auto obj= "administrator@potlatchschools.org" password= "<password>" binPath= "C:\Program Files (x86)\Google\Drive\srvany.exe"
  6. Goto your Start Menu, type in regedit32 and goto the new service (in this case GoogleDriveSync) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\GoogleDriveSync
  7. Create subkey Parameters below which you must create two string values:
    1. Create a String Value called Application then right click on this and add the path to googledrivesync.exe (e.g C:\Program Files (x86)\Google\Drive\googledrivesync.exe)
    2. Create a String Value called AppParameters with the relevant parameters for googledrivesync.exe (e.g /autostart --noshow_confirmation_dialog_on_delete)
  8. From the command prompt run net start GoogleDriveSync or start the service via the services snap-in

You can then manage Google drive as a service. If you need to edit the settings within drive log in as the account that the service is running under, stop the service then start Google drive from the icon in the start menu. When you have completed the changes to the settings close the google drive desktop application and start the service back up again.

Monday, July 28, 2014

URBackup on FreeNAS

Ok, so I decided to create a cheap backup server.  Bought 4 - 3TB hard drives on Amazon.  Installed in a workstation that I already had.  Set it up in the server room.

The FreeNAS install process is really simple so I won't go into detail about that.  The URBackup install was somewhat easy as well, but I want to detail that here for anyone who wants to recreate.

Install FreeNAS and reboot.  Connect and set a root password.
http://doc.freenas.org/index.php/Quick_Start_Guide

I followed the instructions in this manual which is perfect.  I didn't have to adjust any of the steps, but for help to others I will outline the same steps here.  http://forums.freenas.org/index.php?threads/urbackup-installation-guide.22117/

Create a Jail
-Jails
-Add Jails
Urbackup
Standard
(fill in default gateway)
uncheck VIMAGE
-OK

Connect to FreeNAS via SSH (must be enabled in services)

Find the number of the jail you created above.
#jls
#jexec 1 tcsh

This enters you into the jail itself.  All commands from now on are specific to the jail itself and should not be run on the FreeNAS system.

#pkg install
#pkg install update
#pkg install nano wget
#portsnap fetch extract
#cd /usr/ports/security/cryptopp
#make CXXFLAGS="-fPIC" (accept all default questions and pop up boxes)
#make install
#pkg install curl

#cd /
#mkdir /urbackup
#cd /urbackup
#wget (download link for latest urbackup tar.gz source)

#tar zxvf urbackup*.tar.gz
#cd urbackup-server-x.y.z
#./configure
#make
#make install

(I had trouble with the install.  It said it was completed, but I had to run the command again to actually get it to install the program into the right folders.)

#adduser urbackup --system --quiet --group --home "/usr/local/var/urbackup" || true
(this is supposed to create the account, but it just brought up the account dialog for me, so I filled it in by hand)
urbackup
urbackup
empty
empty
empty
empty
empty
/usr/local/var/urbackup
empty
no
no
yes
no

#nano /etc/rc.d/urbackup_srv

Paste the below into the file:
#!/bin/sh
. /etc/rc.subr
name=urbackup_srv
rcvar=urbackup_srv_enable
command="/usr/local/sbin/$(name)"
command_args="--plugin /usr/local/lib/liburbackupserver_urlplugin.so --plugin /usr/local/lib/liburbackupserver_cryptoplugin.so --plugin /usr/local/lib/liburbackupserver_downloadplugin.so --plugin /usr/local/lib/liburbackupserver_fsimageplugin.so --plugin /usr/local/lib/liburbackupserver_httpserver.so --plugin /usr/local/lib/liburbackupserver.so --http_root /usr/local/var/urbackup/www --workingdir /usr/local/var --user urbackup --http_port 55414 --logfile /var/log/urbackup_srv.log --daemon"
start_precmd="cd /usr/local/var"
load_rc_config $name
run_rc_command "$1"

The command args line should be one complete line.

#chmod +x /etc/rc.d/urbackup_srv

#nano /etc/rc.conf

Add this line to the end:
urbackup_srv_enable="YES"

#mkdir /backups
#chown -R urbackup:urbackup /backups

#/etc/rc.d/urbackup_srv start

Access the web interface at http://[ipaddress]:55414
Go to Settings / General / Server
Adjust the [Backup Storage Path] from the default to /backups

#/etc/rc.d/urbackup_srv restart

From FreeNAS web click on the Jails -> Urbackup -> Storage -> Add Storage and connect the /backups folder with the FreeNAS volume created.  I want all of the storage space available to the backup jail, so I connected it straight.

Next is the client on the servers, for sending files to URBackup.  More on that process in another post.

Tuesday, June 10, 2014

Raspberry Pi Chromium Digital Sign w/ PHP Reboot button

I am following these instructions, but am giving full detail of my instructions.  I am also adding a PHP webpage to reboot the pi remotely without knowing the passwords so other staff can do it.

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install matchbox x11-server-utils unclutter chromium ttf-mscorefonts-installer
sudo reboot

Setup Auto-login
sudo nano /etc/inittab
comment out the line (#)1:2345:respawn:/sbin/getty 115200 tty1
add: 1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1




That is all I did.



sudo apt-get install php5
cd /var/www
sudo rm index.html
sudo nano index.php

<?php
if(isset($_POST['s'])){
        echo "Rebooting NOW<br />\n";
        touch('/tmp/reboot.now');
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action='index.php' method='post'>
<input type='submit' name='s' value='Reboot' />
</form>
</body>
</html>

sudo nano /usr/local/sbin/reboot.sh

#!/bin/bash
if [ -f /tmp/reboot.now ]; then
        rm -f /tmp/reboot.now
        /sbin/shutdown -r now
fi

sudo chmod +x /usr/local/sbin/reboot.sh
sudo crontab -e

* * * * * /usr/local/sbin/reboot.sh


Wednesday, March 19, 2014

Format SD Card with Linux partitions

If you have ever used a Raspberry Pi but had to setup the SD card using a windows computer than you know the frustration you get when the disk only shows 56 Mb instead of the 14 Gb that it should be!

I spend a good hour trying to figure this out every time I try and reformat the card with the latest version of Rasbian.  I know I should just keep this in my list of bookmarks, but now I realize that I should just blog the steps as I have with everything else, so that I have it for posterity!

Anyway, Windows 7 has a great tool called diskpart.  Never really knew how fantastic it was until now.  Back in the day it was fdisk, but diskpart is much more powerful and easier to use!

diskpart
list disk
select disk # (the sd card disk number that was listed above)
clean (clears partition table)
exit

This step seems to be required if using my laptop, but I don't know if everyone has to do this or not.
Pull out the sd card and put it back in after a few seconds.

diskpart
list disk
select disk # (is probably the same, but might not be)
create partition primary
format fs=fat32 quick
exit

Done!  It is that easy!

I know that you can also put the card in a camera and format it there to reset the partition table, but I don't have a camera handy all the time!

Hope this helps others.

Wednesday, February 19, 2014

Increase Ubuntu Hard Drive Size in VMWare ESXi

I have only done this with my Ubuntu virtual machine so far, so I can't tell you if this works for any other form of linux.  I will have to test it some time to find out.

My situation:  Koha library system loaded on a Ubuntu Server 13.10.  I had originally set it up as a test server so I only gave it 2Gb of ram and a 30 Gb hard drive.

Logs can fill up fairly quickly with everything going on, and the database takes space when you have 20,000 book records and 500 student records.

I followed these instructions to increase the hard drive size of my server, on the fly and it worked perfectly, now I have storage space again and the system is working again!

http://www.joomlaworks.net/blog/item/168-resizing-the-disk-space-on-ubuntu-server-vms

First step is to increase the hard drive to the virtual machine.  I had lots of space, and could add more, but I thought 80Gb would be a good amount for now.  So I increased it by 50Gb to make it 80Gb in total size.

Then access the machine with PuTTy.

List all partitions
$ ls -la /dev/sda*

Create new partition using fdisk:
$ sudo fdisk /dev/sda
p - to list all partitions
n - to create a new partition
l - for "logical"
Accept the default start and end blocks, as that is the new section that has been allocated.
t - to change the partition type
8e - set the type to Linux LVM
p - to list the new partition table
w - to write the changes

A warning message will say that the new drive won't be available until you restart, or use this command:
$ sudo partprobe


Now it is time to create the partition, extend the current volume and reprobe the partition table.

Create partition on new disk - (mine was /dev/sda4, yours might be different)
$ sudo pvcreate /dev/sda4

Display the current volume group and get the name
$ sudo vgdisplay - "VG Name" is what you are looking for here

Extend the volume group with the new partition
$ sudo vgextend VGName /dev/sda4

Get the name of the main logical volume
$ sudo lvdisplay - "LV Name" is what you are looking for here

Extend the logical volume by X Gbs
$ sudo lvextend -l -XG LVName

Resize the file system to account for the new space
$ sudo resize2fs LVName

You can now check to see if the total space is much larger
$ sudo df -hT

This should be all that you need, I did another
$ sudo partprobe
to verify that the system was aware of all the space.

I had some services crash and wouldn't start because of the lack of hard drive space, Apache2 and MySql5 wouldn't start.  After this process I was able to sudo service start and they both came up fine.