Bash Script help...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi All,

I need to write a script that I will manually start (or a cron job in  
future) but I need it to do a number of things in order one after  
another.  How do i do that so everything gets dont as the steps depend  
on each other.

Example:

cd /system_backups/

tar cvf apache-conf.tar /etc/httpd/conf/*
gzip -v9 apache-conf.tar

tar cvf apache-data.tar /var/www/*
gzip -v9 apache-data.tar

then last step...
tar cvf <current_date>-system_backup.tar <all> the gzip files above
gzip -v9 <current_date>-system_backup.tar

scp <current_date>-system_backup.tar.gz user@xxxxxxxx:/.
etc...etc....

My questions:
1. How do I execute each statement and make sure subsequent statements  
are not executed until the previous is done?

2. How do I error check so if a step fails the script stops?

3. Since I run an SMTP Server on this box can I e-mail myself from  
bash the nightly results?

4. when I want to run the scp to send over the file to another machine  
for safety, how can I have it know the password to the machine I am  
scp'ing to?

My mind is going crazy sort of with the things that I could do to  
protect myself in case of a system failure and making restoring easier.

Can anyone provide insight for me?

-Jason
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux