Perl Assignment #8: 

Processing Text with Regular Expressions

More Control Structures

 

CS 447/647

Spring, 2012

 

 

Due: 3/27/12

 

Read chapter 9 of Learning Perl.  Do exercises 1 and 3.

Read chapter 10 of Learning Perl.  Do exercise 1.

 

Script assign8.txt

PS1=’$ ‘

cat ex9-1.pl

perl ex9-1.pl

# do the hands-on below

sudo tail /var/log/syslog

exit

 

Submit you’re assign8.txt via Web Campus.

                                                                      

Hands-On Exercise

 

(see other side)


 

                                                           

Write to Syslog from the command line:

logger –p local5.warning ‘test’

 

Write to Syslog from the from Perl:

use Sys::Syslog;

openlog(“adminscript”, “cons,pid”, “user”);

syslog(“warning”,”Test Log Message”);

closelog;          

# if you copy and paste – change the quotes to double quotes

# In vim try: :%s/\./”/g

 

Add to the end of your assign8.txt:                                                 

tail /var/log/syslog                                                                                                                             

 

Use ssh to connect to your system remotely:

On-campus access to port 22 is blocked by the campus firewall

Create a ssh tunnel to your system through one the CSE login servers

(banyan, sequoia, pine) which has port 22 open.

 

This page describes how to create a tunnel using PuTTY:

http://stefan.huberdoc.at/comp/techblog/ssh_tunnel.html

 

You can also create tunnels using ssh:

http://www.revsys.com/writings/quicktips/ssh-tunnel.html

 

Download PuTTY here:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

 

(Optional) For those who installed at home you’ll probably need to setup port forwarding on your NAT box to access your system from outside your home network. 

Check http://portforward.com for help.