User Tools

Site Tools


user:vcordes1:portfolio:bpe

Best Evar

  • The goal of this project is to in a very round about way post on the the great interwebs a random number every day at 4:58.

Procedure

  • The first step is going to the writing of a C program that will generate a random number.
  • Step number 2 will involve writing a shell script to run the C program, print out all of the necessary html tags and include the randomly generated number
  • Step 3 involves the writing of another shell script to run the shell script and save
  • The last step is to set up a cron job that will run the second shell script at 4:58 every day

Necessary Knowledge

  • Shell scripting
  • HTML
  • commands
  • C programming

Stuff I Used

  • This is the C program
#include<stdio.h>

int main()

{

srand(time(NULL));
	printf("%d ", (rand() %  1200));

return(0);

}
  • This is the first shell script
/home/vcordes1/public_html/RndNumberGen > /home/vcordes1/public_html/RndNumber


echo "<html>"
echo "	<head>"
echo "		<title>Welcome to Random</title>"
echo "	<style type = "text/css">"
echo "	<!--"
echo "	h1 {font-size: 16pt;}"
echo "  h2 {font-size: 16pt;}"
echo "  p  {font-size: 16pt;"
echo "     position: relative;"
echo "     left: 1in;}"
echo "  h3 {font-size: 16pt;}"
echo "     body {background-color: #C0C0C0;"
echo "     font-family: Verdana, Arial;}"
echo "  -->"
echo "  </style>"
echo "	</head>"
echo "  <body>"
echo "  <p>This is the random number of the day: `cat RndNumber`</p>"
echo "</body>"
echo "</html>"
  • This is the second shell script
/home/vcordes1/public_html/RndNumberScript > /home/vcordes1/public_html/RndNumberPage.html

Attributes

  • Scripting
  • Commands
  • Files and Directories
  • The Unix Shell
  • The Unix Development Environment
  • Text processing
  • Job Control & Multitasking

Final Thinkings

  • A fun project only a little bit of a pain to get cron to find everything properly
user/vcordes1/portfolio/bpe.txt · Last modified: 2011/12/15 17:32 by vcordes1