Categories
Cygwin Shepherd Windows 8

Install CygWin and Shepherd for Windows (Updated Version)

Cygwin Installation

1. Download setup.exe from the Cygwin site:

http://www.cygwin.com/setup.exe


2. Execute the setup.exe that you downloaded:

setup.exe -dq -R d:\cygwin -s http://mirror.aarnet.edu.au/pub/sourceware/cygwin -O -P perl -P make -P gcc4 -P wget

The setup program will download and install some mandatory packages as well as the extra ones you listed. This will take about 10 minutes.

At the end, it might show an error “cygutils.sh exit code 127”, but this can be ignored. Or, the setup program might simply close.

3. Copy the setup.exe to the cygwin directory for safe-keeping:

cmd /c copy "setup.exe" d:\Cygwin\usr\local\bin\

If you ever need to install other packages, just drop to a cygwin terminal and run “setup”.

4. The Start menu should now have a new “Cygwin” program group with “Cygwin Terminal”

CPAN Module Installation

Start the Cygwin Terminal: Start -> Cygwin -> Cygwin Terminal

1. Install CPAN modules:

cpan -i Module::Build CPAN::Meta::YAML ExtUtils::MakeMaker Date::Manip XML::Writer Lingua::EN::Numbers::Ordinate Lingua::Preferred Term::ProgressBar Unicode::String HTTP::Cache::Transparent HTML::TreeBuilder XML::Simple Sort::Versions Algorithm::Diff List::Compare Sort::Versions File::Slurp

When prompted, select defaults by pressing “enter”. This can take 20 minutes or more.

2. Install XML::Twig

cpan -i XML::Twig

When prompted (5 times), select defaults by pressing “enter”.

3. Install XMLTV from Official Site

Note: The version of XMLTV on CPAN is too old for shepherd.

$ wget http://downloads.sourceforge.net/project/xmltv/xmltv/0.5.63/xmltv-0.5.63.tar.bz2
$ tar -xjvf xmltv-0.5.63.tar.bz2
$ cd xmltv-0.5.63
$ perl Makefile.PL
[select defaults]
$ make
$ make install

4. Update https module

sudo cpan -fi LWP::Protocol::https

Shepherd Installation
1. Start the Cygwin Terminal: Start -> Cygwin -> Cygwin Terminal
2. Prepare the directory and download Shepherd

$ mkdir -p .shepherd/applications/shepherd
$ cd .shepherd/applications/shepherd
$ wget www.whuffy.com/shepherd/shepherd

3. Run shepherd, using fully-qualified path to pull in the modules:

$ perl `pwd`/shepherd

[ignore “Caught a die()” errors]

Note that this creates a symlink ~/.shepherd/shepherd that we will use from now on.

Choose appropriate location and channel details.

Select “no” when asked for MythTV auto-configure.

$ cd

4. Disable mythtv module:

$ ~/.shepherd/shepherd --disable Shepherd/MythTV.pm

5. Check shepherd:

~/.shepherd/shepherd --check

6. Grab data for the first time:

~/.shepherd/shepherd --noupdate

Make a Scheduled Task

1. Launch Task Scheduler
2. Start -> Control Panel -> Performance and Maintenance -> Scheduled Tasks

3. Create a new “check” task using the wizard

    Add Scheduled Task -> Next -> Browse -> C:\cygwin\bin\mintty.exe
    Set Name: “Shepherd”
    Set Frequency: Daily -> Next
    Set Start time: 2am -> Next
    Enter your credentials -> Next

4. Click on “Open advanced properties”
Set Run:

C:\cygwin\bin\mintty.exe --hold --exec /bin/sh -c 'PATH=$PATH:/usr/bin ~/.shepherd/shepherd --check"

Clear “Start in” -> OK
Enter your credentials

5. Manually run the task

6. Return to the scheduler.

7. Right-click on the new task and select “run”

8. Check that it runs correctly.

9. Adjust the task to final state

10. Right-click on the task to edit the properties
On the “Settings” tab: stop if runs for more than 3 hours
On the “Task” tab: remove both “–check” and “–hold” from the “Run” option so that it becomes:

C:\cygwin\bin\mintty.exe --exec /bin/sh -c 'PATH=$PATH:/usr/bin ~/.shepherd/shepherd"

To run in a hidden window, add “–window hide” as a parameter to mintty, such as:

C:\cygwin\bin\mintty.exe --window hide --exec /bin/sh -c 'PATH=$PATH:/usr/bin ~/.shepherd/shepherd"

To log all output to a file, redirect shepherd’s output, such as:

C:\cygwin\bin\mintty.exe --exec /bin/sh -c 'PATH=$PATH:/usr/bin ~/.shepherd/shepherd --check >~/shepherd-task.log 2>&1"

Come back the next day and check the status of the scheduled task (might need to scroll to the right to see status) and the output of the log file shepherd-task.log.

By Myles Freeman

Just me, nothing to see here..