No problem. I was a newbie once myself. In fact I'm still a newbie in some of the other forums!
A shell in unix is a program that accepts your commands and does something with them. When you log onto unix and type "cd somedirectory", it's the shell that you're talking to. It's the shell that carries out your command. This is similar to CMD.EXE in the MS Windows world. You can also put a bunch of commands into a file and execute them by just executing the file. This is called a shell script and is analogous to a batch file in the MS Windows world.
There are many different shells, each with their own syntax and usage. The most common are the Korn shell (my favorite), the Bourne shell, and the C shell. There are lots of books on the various shells. One good one on the Korn Shell is
The Korn Shell by
Anatole Olczak. There's also a good web site at
To FTP your file each night, create a file in your home directory called
. Make it contain the following...
[tt]
#!/bin/ksh
export FILE=filetosent.txt # Change to the file to send
export DESTINATION=127.0.0.1 # Change to where it needs to go
print "FTPing ${FILE} to ${DESTINATION} at $(date)"
ftp ${DESTINATION} <<-FTMCMDS
user <username> <password>
put ${FILE}
bye
FTPCMDS
print "Done!"
[/tt]
You'll need to change the filename to send, the destination machine, and the username and password, but this is a basic shell script to FTP a file somewhere.
Then, go to the command line and type the following...
This will make the shell script executable. To try it out at the command line, just type...
If it's all correct, it should FTP the file to that machine.
Now to set it up as a cron job, make another file in your home directory called [tt]my_crontab[/tt]. Make it contain the following...
Code:
0 18 * * * nightly_ftp.ksh > nightly_ftp.log 2>&1
This is telling cron to run your script every night at 6pm, and send all output messages from the script to a file called
. Then, to make this your active crontab file, type the following command...
[tt]
crontab my_crontab
[/tt]
This is a quick and dirty example, so there may be mistakes in it, but this should get you started. Check the manual pages for the different commands for more information. At the prompt type...
[tt]
man ksh
man chmod
man crontab
man cron
man ftp
[/tt]
Hope this helps.