Re: Bash Script help...

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



Jason Todd Slack-Moehrle wrote:
> 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/

CD = $(date +%Y-%m-%d)

if ! tar cvf apache-conf.tar /etc/httpd/conf/* && gzip -v9 apache-conf.tar; then 
	echo "FATAL ERROR 1"
	exit
elif
if ! tar cvf apache-data.tar /var/www/* && gzip -v9 apache-data.tar; then 
	echo "FATAL ERROR 2"
	exit
elif
if ! tar cvf $CD-system_backup.tar apache-*.tar.gz && gzip -v9 $CD-system_backup.tar; then 
	echo "FATAL ERR 3"
	exit
elif
scp $CD-system_backup.tar.gz user@xxxxxxxx:/.




if this is run in a cronjob, any output will be mailed to the user who owns the cronjob.  this user's email can be aliased via /etc/aliases to another account if needed.


_______________________________________________
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