How to write a shell program to automize the backup process?

How to write a shell program to automize the backup process?

Post by Richard Chan » Fri, 09 Jul 1999 04:00:00



Hi,
I need to run the following scripts  at 9:00PM every day,
cd /u1/TEST
ftp -i 123.145.100.17

after I open a ftp session
I need to type in login name and password
and then I need to type: mput * manually each time each day
to copy all the files in /u1/TEST to my Windows NT server's related
directory.

Is there a way to automated this daily backup process?
such as writing a shell:
at 9:00 PM
do ...
ftp ...
done
 I appreciated for anyone who can help.

Richard

 
 
 

How to write a shell program to automize the backup process?

Post by H?kan Rissane » Fri, 09 Jul 1999 04:00:00


Create a .netrc file in your home directory containing this info
machine your_remote_servername_or_IP_address_here
login your_user_name_here
password users_password_here
macdef init
mput *
bye

chmod 600 .netrc # File MUST have this permissions set to work.
See man ftp and man netrc for more info on syntax of .netrc

Next write a script ftpbackup.sh containing theese three lines.
#!/usr/bin/ksh
cd /u1/TEST
ftp your_remote_hostname_or_IP_address_here

chmod u+x ftpbackup.sh  # Set execute right on the script
add this script to cron
crontab -l >cronfile (list your crontable if you already are running
cron jobs and puts it in the file cronfile)
echo "0 9 * * * /home/yourehomedir/ftpbackup.sh >/tmp/ftpbackup.log
2>&1" >> cronfile  # Run at 9.00 everyday.
crontab cronfile  # Adds the new cronfile to cron

/H?kanen


> Hi,
> I need to run the following scripts  at 9:00PM every day,
> cd /u1/TEST
> ftp -i 123.145.100.17

> after I open a ftp session
> I need to type in login name and password and then I need to type:
> mput * manually each time each day to copy all the files in /u1/TEST
> to my Windows NT server's related directory.

> Richard



 
 
 

How to write a shell program to automize the backup process?

Post by Ken Abrahamse » Fri, 09 Jul 1999 04:00:00


See man cron
ken
======

>Hi,
>I need to run the following scripts  at 9:00PM every day,
>cd /u1/TEST
>ftp -i 123.145.100.17

>after I open a ftp session
>I need to type in login name and password
>and then I need to type: mput * manually each time each day
>to copy all the files in /u1/TEST to my Windows NT server's related
>directory.

>Is there a way to automated this daily backup process?
>such as writing a shell:
>at 9:00 PM
>do ...
>ftp ...
>done
> I appreciated for anyone who can help.

>Richard


 
 
 

1. How to write a C-shell program to print return value of a program

Hi:

Since I am not familiar with C-shell programming. I am wondering
if someone can tell me how to write a simple C-shell program
that prints out the return value of a program after executing it?

My C program will look like this:

main()
{
 int return_val;
  ..................
  ..................
 do_program_exit(return_val);

void do_return_val(return_val)
int return_val;
{
 ..................
 ..................
 exit(return_val);

Please email me your advice. Thanks in advance!

Yang-Cheng

2. Setting up MMDF for the SMTP Channel?

3. Backup program that writes more than once to a tape

4. Linux Backup with MSDOS mini-HOWTO (part 1/1)

5. How to write a program that monitors a process

6. Using bsd_comp.o under 1.2.13

7. how can I write a shell program to count how many files in this directory?

8. Smc-ultra fails to load... (device not available)

9. Need help writing UNIX shell program

10. Can I write such kind of Shell Program?

11. How to write shell script to run program over and over?

12. Can I write such kind of Shell Program?

13. controlling ftp process from a shell script or program