CIS 375: Networking and Telecomminications

Gabelli School of Business, CIS Department

| CISWEB Doug White | RWU Main | White Hat Research | Email Doug | Access Data |

Lab 3: Fall 2008

Shell Scripts:

Shell scripts are very common and allow you to create all sorts of programs and solutions to problems in an automated fashion. In this exercise, you are going to put an instruction into a script and then run it automatically using cron.

>touch lab3.sh

>vim lab3.sh

//press i to enter insert mode

#!/bin/bash

/usr/sbin/whoami

//press :wq to save and exit

Now reset the permissions so that it runs (see lab 2 if you forgot)

We want to experiment with your cron so now

>crontab -e

//This is a way to automate jobs.

//Cron has multiple fields (type man cron if you don't know them)

//enter this line. Use your username for the username part

/5 * * * /home/??username??/lab3.sh

//save and exit

Now watch. Every 5 minutes you should see the whoami command run. This is silly but it lets you see how to automate something in cron. I would suggest you remove it by deleting the line in cron (crontab -e) so it doesn't drive you crazy.

//report

 

 

| Contact | © 2005 Secure Technology, LLC. |