Jason Todd Slack-Moehrle <mailinglists at ...> writes: > > 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 at ...:/. > etc...etc.... > > My questions: > 1. How do I execute each statement and make sure subsequent statements > are not executed until the previous is done? by using && example cd /system_backups/ && \ tar cvf apache-conf.tar /etc/httpd/conf/* && \ gzip -v9 apache-conf.tar > 2. How do I error check so if a step fails the script stops? I am afraid I do not have enough knowledge to help you in the above question > > 3. Since I run an SMTP Server on this box can I e-mail myself from > bash the nightly results? Yes > > 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? You cant You will have to ssh-keygen Thanks and Regards Rajagopal