Sign up to create your own snipts, or login.

Public snipts » backup The latest public backup snipts.

showing 1-20 of 24 snipts for backup
  • backup all git repositories that are in one folder
    #!/bin/bash
    
    BACKUP_FOLDER="/home/srvadm/p2backups"
    NUM_GROUPS="30"
    
    cd "$BACKUP_FOLDER"
    
    echo "backup at: `date`"
    
    for i in `ls`; do
    	if [ -d "$i" ]; then
    		echo "backing up repository: $i"
    		cd "$i"
    		git pull
    		cd ..
    	fi
    done
    

    copy | embed

    0 comments - tagged in  posted by prauber on Feb 25, 2010 at 5:55 a.m. EST
  • backup DB with PHP script+Ajax
    <?php 
    // in adminDBSuccess.php template file, call another action "ajaxBackup" with Ajax
    echo jq_link_to_remote(image_tag('backup'),
        array
        (
          'update' =>'feedback_backup',
          'url'    =>'homepage/ajaxBackup',
          'loading' => jq_visual_effect('fadeIn',  '#indicator_backup'),
          'complete'=> jq_visual_effect('fadeOut', '#indicator_backup')
        ));
    ?>
    
    // action ajaxBackup in actions.class.php
    public function executeAjaxBackup(sfWebRequest $request)
    {
      return $this->renderPartial('homepage/backupDBSuccess');
    }
    
    //_backupDBSuccess.php partial template
    <?php if(!require_once(dirname(__FILE__).'/../../../../../web/backup.php')): ?>
      <?php echo "backup.php file not found or it doesn't work correctly." ?>
    <?php endif; ?>
    
    // backup.php script to backup DB
    <?php
    include('db_config.php');
    
    backup_tables($dbhost,$dbuser,$dbpassword,$dbname,$tables, $backup_dir);
    
    /* backup the db OR just a table */
    function backup_tables($host,$user,$pass,$name,$tables, $backup_dir)
    {
    	$return ='';
    	$link = mysql_connect($host,$user,$pass);
    	mysql_select_db($name,$link);
    	
    	//get all of the tables
    	if($tables == '*')
    	{
    		$tables = array();
    		$result = mysql_query('SHOW TABLES');
    		while($row = mysql_fetch_row($result))
    		{
    			$tables[] = $row[0];
    		}
    	}
    	else
    	{
    		$tables = is_array($tables) ? $tables : explode(',',$tables);
    	}
    	
    	//cycle through
    	$return.='SET FOREIGN_KEY_CHECKS=0;'."\n";
    	foreach($tables as $table)
    	{
    		$result = mysql_query('SELECT * FROM '.$table);
    		$num_fields = mysql_num_fields($result);
    		
    		$return.= 'DROP TABLE '.$table.';';
    		$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
    		$return.= "\n\n".$row2[1].";\n\n";
    		
    		for ($i = 0; $i < $num_fields; $i++) 
    		{
    			while($row = mysql_fetch_row($result))
    			{
    				$return.= 'INSERT INTO '.$table.' VALUES(';
    				for($j=0; $j<$num_fields; $j++) 
    				{
    					$row[$j] = addslashes($row[$j]);
    					$row[$j] = ereg_replace("\n","\\n",$row[$j]);
    					if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
    					if ($j<($num_fields-1)) { $return.= ','; }
    				}
    				$return.= ");\n";
    			}
    		}
    		$return.="\n\n\n";
    	}
    	$return.='SET FOREIGN_KEY_CHECKS=1;'." \n";
    	
    	//save file
            
    	//$handle = fopen($backup_dir.'db-backup-'.date('Y-m-d').'-'.(md5(implode(',',$tables))).'.sql','w+');
    	$filename = date('Y-m-d_H:i:s').'.sql';
    	$handle = fopen($backup_dir.$filename,'w+');
    	fwrite($handle,$return);
    	echo sprintf('[%s] DB backup successed !<br> <small>%s</small><br>',date('Y-m-d H:i:s'),$backup_dir.$filename);
    	fclose($handle);
    }//end function
    
    // DB configuration file db_config.php
    <?php
    
    
    // please configurate here your db connection and path of backup
    $dbhost = "localhost";
    
    $dbname = "kqb";
    
    $dbuser = "root";
    
    $dbpassword = "something";
    
    $tables ='*'; //if only one table should be saved, give the name of table. Default *, means any table in DB
    
    $backup_dir ='/var/www/clean/kqb-v2/backup/'; // Folder where sql should be stored, please "chmodd 777 $backup_dir"
    

    copy | embed

    0 comments - tagged in  posted by toledot on Feb 23, 2010 at 7:30 a.m. EST
  • Backup index.php Super45.net
    <?php get_header(); ?>
    
     <div id="row1">
      <div id="discodestacado">
           <h2><img src="/images/disco-destacado.png" alt="Disco Destacado" /></h2>
    	   <div id="contenedor-disco">
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=1488');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
                        <div id="foto-tit-dd">
    			<div id="fotodd"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div id="titdd"><h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3></div>
                         </div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?> 
    	   </div>
      </div><!-- end of discodestacado div -->
      <div id="otrosdiscos">
             <h2><img src="/images/en-breve.png" alt="En Breve" /></h2>
    		 <div id="slider">
    			<ul>
    
    
    				<li>
    
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=6&cat=1489');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
                           <div class="d-breve"><div class="foto-breve"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div><div class="tit-breve"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div></div>
    
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    				</li>
    				
    				<li>
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=6&offset=6&cat=1489');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
                           <div class="d-breve"><div class="foto-breve"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div><div class="tit-breve"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div></div>
    
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    				</li>
    			
    				<li>
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=6&offset=12&cat=1489');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
                           <div class="d-breve"><div class="foto-breve"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div><div class="tit-breve"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div></div>
    
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    				</li>
    				
    
    				
    			</ul>
    		 </div>
      </div><!-- end of otrosdiscos div -->
    
    
    
      <div id="publi1">
    <script type='text/javascript'><!--//<![CDATA[
       var m3_u = (location.protocol=='https:'?'https://open.estupendos.net/www/delivery/ajs.php':'http://open.estupendos.net/www/delivery/ajs.php');
       var m3_r = Math.floor(Math.random()*99999999999);
       if (!document.MAX_used) document.MAX_used = ',';
       document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
       document.write ("?zoneid=2");
       document.write ('&amp;cb=' + m3_r);
       if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
       document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
       document.write ("&amp;loc=" + escape(window.location));
       if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
       if (document.context) document.write ("&context=" + escape(document.context));
       if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
       document.write ("'><\/scr"+"ipt>");
    //]]>--></script><noscript><a href='http://open.estupendos.net/www/delivery/ck.php?n=a75a6856&amp;cb=23544353' target='_blank'><img src='http://open.estupendos.net/www/delivery/avw.php?zoneid=2&amp;cb=23544353&amp;n=a75a6856' border='0' alt='' /></a></noscript>
      </div><!-- end of publi1 div -->
    
    
    
     </div><!-- end of row1 div -->
    
    
    
    
     <div id="row2">
      <div id="destacado">
    	     <h2><img src="/images/destacamos.png" alt="Destacamos en S45" /></h2>
    
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=1509');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 <div id="contenedor-destacado">
    			<div class="foto-destacado"><?php get_the_image('custom_key=foto-home&default_size=full&default_image=/images/medium.png'); ?></div>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<p class="metadata"><?php
    foreach((get_the_category()) as $cat) {
    if ($cat->cat_ID != "1509" )
    {
    echo '<a href="/?cat=' . $cat->cat_ID . '"> ' .
    $cat->cat_name . '</a> ';
    }
    }
    ?> | Por <?php the_author_posts_link(); ?> | <?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    		 </div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    
    
    	<?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=5&offset=1&cat=1509');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php
    foreach((get_the_category()) as $cat) {
    if ($cat->cat_ID != "1509" )
    {
    echo '<a href="/?cat=' . $cat->cat_ID . '"> ' .
    $cat->cat_name . '</a> ';
    }
    }
    ?> | <?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    		 <div class="clear-destacado"></div>
    			<?php endwhile; ?>
    		<?php else : ?>
    		<?php endif; ?>
    
    
    
    
    		 
      </div><!-- end of destacado div -->
      <div id="articulos">
    	<ul>
    		<li><a href="#tabs-1"><img src="/images/blog.png" alt="Blog" /></a></li>
    		<li><a href="#tabs-2"><img src="/images/noticias.png" alt="Noticias" /></a></li>
    		<li><a href="#tabs-3"><img src="/images/articulos.png" alt="Articulos" /></a></li>
    	</ul>
    
    	<div id="tabs-1">   
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=8&cat=41');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    	
            <div class="vertodos"><a href="/seccion/blog/" title="Ver todo el blog">[+] Ver todos</a></div>	 
    
    
    
    	</div>
    
    	<div id="tabs-2">   
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=8&cat=3');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    <div class="vertodos"><a href="/seccion/noticias/" title="Ver todas las noticias">[+] Ver todos</a></div>
    		 
    
    	</div>
    	
    	<div id="tabs-3">   
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=42');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 <div id="contenedor-articulo">
    
    
    
    			<div class="contenedor-foto-articulo"><?php get_the_image('custom_key=foto-home&default_size=full&default_image=/images/medium.png'); ?></div>
                            <div class="cat-arti"><?php the_category(); ?></div>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<p class="metadata">Por <?php the_author_posts_link(); ?> | <?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    		 </div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>		 
    
    
    
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=5&offset=1&cat=42,44,45');
    ?>
    		<?php while (have_posts()) : the_post(); ?>		 
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
                            <div class="cat-arti"><?php the_category(); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>		 
    		 
    		
    
    <div class="vertodos"><a href="/seccion/articulos/" title="Ver todos los artículos">[+] Ver todos</a></div>
    
    	</div>
    
    	
      </div><!-- end of articulos div -->
      <div id="radio">
        <div id="s45radio">
    
    		<h2><img src="/images/2009/06/super-45-radio.png" alt="S45 en Radio Duna" /></h2>
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=49');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    	    <div id="foto-radio"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
            <div id="txt-radio">
    			<span class="prox-radio">Pr&oacute;ximo programa:<br /></span>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<?php the_excerpt() ?>
    		</div>	 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    
    		<div class="podcast">
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=21');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
            <div id="txt-podcast">
    			<p class="podcast-anterior">Descarga el programa anterior:</p>
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<div class="excerpt-podcast"><?php the_excerpt() ?></div>
    	</div>	 
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    		</div>
    	</div>	
    	<div id="ad-radio1"></div>		 
    
    
    
      <div id="agenda">
    	<ul>
    		<li><a href="#tabs-4"><img src="/images/nuestra_agenda.png" alt="Nuestra Agenda" /></a></li>
    		<li><a href="#tabs-5"><img src="/images/cartelera.png" alt="Cartelera" /></a></li>
    		<li><a href="#tabs-6"><img src="/images/concursos.png" alt="Concursos" /></a></li>
    	</ul>
    
    	<div id="tabs-4">   
    	 
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=2&cat=1511');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    		 
    					<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    		 
    		 
    
    	</div>
    
    	<div id="tabs-5">
    
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=35');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado25"></div>
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    		 
    		 
    		 
    
    	</div>
    	
    	<div id="tabs-6">   
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=1&cat=66');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 <div class="sub-destacado">
    			<div class="foto-sub-destacado"><?php get_the_image('custom_key=foto-home&default_size=thumbnail&default_image=/images/thumb.png'); ?></div>
    			<div class="txt-sub-destacado">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado2"></div>
    			<?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    
    <?php if (have_posts()) : ?>
    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=2&offset=1&cat=66');
    ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		 
    		 <div class="sub-concurso">
    			<div class="txt-sub-concurso">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p class="metadata"><?php the_time('d.m.y') ?> | <?php comments_popup_link('<img src="/images/icon-comm.png" alt="Comentarios" /> 0', '<img src="/images/icon-comm.png" alt="Comentarios" /> 1', '<img src="/images/icon-comm.png" alt="Comentarios" /> %'); ?></p>
    			</div>
    		 </div>
    	     <div class="clear-destacado"></div>
    <?php endwhile; ?>
    	<?php else : ?>
    	<?php endif; ?>
    
    
    		 
    
    		 
    
    		 
    
    	</div>
    
    	
      </div><!-- end of agenda div -->
    
    
    
      
      
      	<div id="ad-radio2"><a href="http://sonik.cl"><img src="/images/300x100-Sonik-S45.gif" alt="Sonik" /></a></div>		 
    
    
    
      	<div id="ad-radio3">
    
    <script type='text/javascript'><!--//<![CDATA[
       var m3_u = (location.protocol=='https:'?'https://open.estupendos.net/www/delivery/ajs.php':'http://open.estupendos.net/www/delivery/ajs.php');
       var m3_r = Math.floor(Math.random()*99999999999);
       if (!document.MAX_used) document.MAX_used = ',';
       document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
       document.write ("?zoneid=5");
       document.write ('&amp;cb=' + m3_r);
       if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
       document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
       document.write ("&amp;loc=" + escape(window.location));
       if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
       if (document.context) document.write ("&context=" + escape(document.context));
       if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
       document.write ("'><\/scr"+"ipt>");
    //]]>--></script><noscript><a href='http://open.estupendos.net/www/delivery/ck.php?n=a5a9a894&amp;cb=5467546' target='_blank'><img src='http://open.estupendos.net/www/delivery/avw.php?zoneid=5&amp;cb=5467546&amp;n=a5a9a894' border='0' alt='' /></a></noscript>
    
    
    </div>		 
    
    	
    
    
    <div id="tla"><?php tla_ads(); ?><br/><?php if (is_callable(array("LinkLiftPlugin", "execute"))) LinkLiftPlugin::execute(); ?></div>
    	
    	
      
      </div><!-- end of radio div -->
     </div><!-- end of row2 div -->
     <div id="row3">
       	     <h2>Comunidad Super 45</h2>
      <div id="eventos">
        	<h3><a href="http://vimeo.com/super45">Noa Noa</a></h3>
    		<div class="videos-oficiales">
    			<!-- START Vimeo Badge ... info at http://vimeo.com/widget -->
    			<div class="vimeoBadge">
    				<script type="text/javascript" src="http://vimeo.com/super45/badgeo/?stream=uploaded&amp;stream_id=&amp;count=4&amp;thumbnail_width=100&amp;show_titles=no"></script>
    			</div>
    			<!--END Vimeo Badge-->
    
    		</div>
    		
    		
      </div><!-- end of eventos div -->
      <div id="vimeo">
    		<h3><a href="http://vimeo.com/channels/super45">Canal Vimeo</a></h3>
    		
    		
    		<!-- START Vimeo Badge ... info at http://vimeo.com/widget -->
    <div class="vimeoBadge">
    		<script type="text/javascript" src="http://vimeo.com/super45/badgeo/?stream=channel&amp;stream_id=34616&amp;count=6&amp;thumbnail_width=100&amp;show_titles=no"></script>
    	</div>
    <!--END Vimeo Badge-->
    
    
    
    
    
    
      </div><!-- end of vimeo div -->
      <div id="flickr">
    	<h3><a href="http://www.flickr.com/super45/">Super 45 en Flickr</a></h3>
    	<div id="contenedor-flickr">
    <!-- Start of Flickr Badge -->
    <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=5&amp;display=latest&amp;size=s&amp;layout=x&amp;source=user&amp;user=39096086%40N04"></script>
    <!-- End of Flickr Badge -->
    
    	</div>
      </div><!-- end of flickr div -->
      <div id="sociales">
    	<ul>
    		<li><a class="facebook" href="http://facebook.com/group.php?gid=13967200331">Grupo Facebook</a></li>
    		<li><a class="facebook" href="http://facebook.com/pages/Santiago-Chile/Super-45/14050945943">P&aacute;gina Facebook</a></li>
    		<li><a class="twitter" href="http://twitter.com/super45">Twitter</a></li>
    		<li><a class="lastfm" href="http://last.fm/group/Super+45">Grupo Last.fm</a></li>
    	</ul>
      </div><!-- end of sociales div -->
     </div><!-- end of row3 div -->
     
     
     <?php get_footer(); ?>
    

    copy | embed

    0 comments - tagged in  posted by estupendos on Jan 28, 2010 at 2:19 p.m. EST
  • Archive mail with archivemail into mbox format
    archivemail --date=2010-01-15 --dont-mangle --include-flagged -n -v --output-dir=archived imaps://"user@domain.com":"password"@mail.domain.com/INBOX.Sent
    

    copy | embed

    0 comments - tagged in  posted by malkir on Jan 27, 2010 at 11:53 p.m. EST
  • Respaldo de templates de programas de Horizonte.cl
    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    
    
    
    			
    
    			<div id="columna_izquierda">
    
    
    
    <div id="programas">
    
    
    
    						<div class="programa">
    			<img src="/images/finaseleccion.jpg" alt="Fina Seleccion" />
    			<h3>Fina <span>Selecci&oacute;n</span></h3>
    
    			<h4>De lunes a viernes a las 22.00 hrs. Repetici&oacute;n el d&iacute;a domingo.</h4>
    			<p>Los archivos favoritos de nuestro cat&aacute;logo musical. Un programa donde podr&aacute;s escuchar discos nuevos, cl&aacute;sicos y compilados de colecci&oacute;n.</p>
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/fina-seleccion/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    		
    		<div class="programa">
    			<img src="/images/5destacados.jpg" alt="5 Destacados" />
    			<h3>5 <span>Destacados</span></h3>
    			<h4>De lunes a domingo a las 8.30, 11.30, 13.30, 16.30 y 19.30 hrs.</h4>
    			<p>Entre millones de descargas anuales, miles de discos mensuales y cientos de canciones Radio Horizonte elige sólo 5 destacados.</p>
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/los-5-destacados/"><span>Ir al Programa</span></a>
    
    			<div class="clear_fix"></div>
    		</div>
    
    		<div class="programa">
    			<img src="/images/versionoficial.jpg" alt="Version Oficial" />
    			<h3><span>Versi&oacute;n</span> Oficial</h3>
    			<h4>De lunes a domingo a las 8.00, 11.00, 14.00, 17.00 y 20.00 hrs. Especial de una hora domingo a las 17.00 hrs.</h4>
    
    			<p>El especialista en covers de Radio Horizonte.</p>
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/version-oficial/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    
    
    		<div class="programa">
    			<img src="/images/agendahorizonte.jpg" alt="Agenda Horizonte" />
    
    			<h3><span>Agenda</span> Horizonte</h3>
    			<h4>De lunes a domingo a las 8.15, 10.15, 13.15, 16.15 y 19.15 hrs.</h4>
    			<p>La ciudad abre sus secretos en el 103.3 todo lo que necesitas saber para que tu vida sea más entretenida: música, conciertos, datos, actualidad, tecnología, cine, fiestas y lo mejor de la cartelera cultural.</p>
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/agenda-horizonte/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    
    
    
    		<div class="programa">
    			<img src="/images/tele.jpg" alt="Tele" />
    			<h3><span>Tele</span></h3>
    			<h4>De lunes a domingo a las 9.15, 12.15, 15.15, 18.15 y 21.15 hrs.</h4>
    			<p>Si vas a ver televisión, déjate guiar por la radio. El mapa audiovisual de Radio Horizonte: programas, series, películas, documentales y más.</p>
    
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/tele/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    
    
    
    
    
    		<div class="programa">
    			<img src="/images/retro.jpg" alt="Retro" />
    			<h3><span>Retro</span></h3>
    			<h4>De lunes a domingo a las 10.00, 13.00, 15.00 y 19.00 hrs.</h4>
    			<p>Un flashback a los tiempos del cassette y el vinilo que revisa los hitos más importantes del mundo del cine, la ciencia, la televisión, el arte y la música; una mirada retroactiva a la cultura pop de los  50 en adelante, con sus respectivas bandas sonoras. Conducido por Carolina Pulido.</p>
    
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/retro/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    		<div class="programa">
    			<img src="/images/catedralencoma.jpg" alt="Catedral en Coma" />
    			<h3>Catedral en <span>coma</span></h3>
    			<h4>Miércoles, en vivo y en directo desde el Bar Catedral desde las 23.00 hrs.</h4>
    
    			<p>Bandas chilenas y extranjeras agitan las noches santiaguinas en un solo escenario. Con Vicente García-Huidobro.</p>
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/catedral-en-coma/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    
    
    		<div class="programa">
    			<img src="/images/ticket.jpg" alt="Ticket" />
    
    			<h3><span>Ticket</span></h3>
    			<h4>De lunes a domingo a las 9.30, 12.30, 15.30, 18.30 y 21.30 hrs. Especial de una hora domingo a las 19.00 hrs.</h4>
    			<p>Una invitación a (re)conocer y (re)descubrir el mundo a través del 103.3. Un viaje sin escalas al lugar donde vive la música. Conduce: Carolina Pulido</p>
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/ticket/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    		<div class="programa">
    			<img src="/images/loop.jpg" alt="Loop" />
    			<h3><span>Loop</span></h3>
    			
    			<p>Cuando el sol se esconde, la música fluorece en Radio Horizonte. No te pierdas la selección musical más bailable de la radiofonía nacional todos los sábados en la noche.</p>
    			<a class="btn_plomo" href="http://www.horizonte.cl/categoria/programas/loop/"><span>Ir al Programa</span></a>
    			<div class="clear_fix"></div>
    		</div>
    
    	</div>
    							
    
    			</div>
    
    				<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
    
    <?php get_footer(); ?>
    

    copy | embed

    0 comments - tagged in  posted by estupendos on Jan 18, 2010 at 3:54 p.m. EST
  • Insert SQL via command line
    -- insert sql via command line
    mysql -u dbuser -p -h dbhost.yoursite.com dbname < /path/to/backup.sql
    

    copy | embed

    0 comments - tagged in  posted by corbanb on Dec 07, 2009 at 1:59 p.m. EST
  • backup a database using date as name file
    mysqldump -u <user> -p<pass> <mysite> -r <mysite>-$(date +%d.%b.%Y).sql
    

    copy | embed

    0 comments - tagged in  posted by juque on Nov 06, 2009 at 6:52 p.m. EST
  • burn cd and dvd's in ubuntu
    #make the image
    $ mkisofs -r -J -o yourbackup.iso /home/path_to/your_files
    #record the image
    $ cdrecord -v dev=/dev/cdrw --speed=24 -data dfdsdf-02Nov.iso
    
    #make an image from a video dvd
    cat /dev/scd0 > ./orange_county_fl_video.iso
    #burn dvd
    $ growisofs -dvd-compat -speed=12 -Z /dev/dvdrw -joliet-long -R -V "myVolume" <filename>
    $ growisofs -Z /dev/dvdrw -R -J /some/files
    #can also use cdrecord to burn dvds
    $ cdrecord -v dev=/dev/cdrw --speed=24 -data dfdsdf-02Nov.iso
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Nov 03, 2009 at 6:41 p.m. EST
  • backup databases from a list of i
    mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e 'SELECT data_bases.name AS "database" FROM data_bases;' > dbnames | sed 's/database//g' dbnames > dbnames2 && cat dbnames2
    
    for i in `cat dbnames2`; do mysqldump --add-drop-table -u admin -p$(cat /etc/psa/.psa.shadow) $i > ${i}-`date +"%m-%d-%y"`.sql; done
    

    copy | embed

    0 comments - tagged in  posted by malkir on Oct 29, 2009 at 6:34 p.m. EDT
  • Moving Magento to another server (the backup part)
    #!/bin/bash
    
    clear
    stty erase '^?'
    
    echo "-- File and DB Backup of Magento --"
    echo "The moving an installation of Magento as written on http://www.magentocommerce.com/wiki/groups/227/moving_magento_to_another_server"
    echo "Please note: It does not backup all the extensions and additional plugins. Back up all the files you added or changed manualy."
    echo
    
    check_dest_dir () {
        echo -n "Please enter the name of the directory the backup files will be stored in: "
        read dest_dir 
        
        if [ -d "$dest_dir" ]; then
        	  echo -n "Directory already exists. Use it for Backup [y] or specify another one [n]?"
        	  read use_dest_dir;
            if  [ "$use_dest_dir" = "y" ] ; then
               do_backup $dest_dir; 
               else  check_dest_dir;
            fi
        
        else 
            echo -n "Directory does not exist. Create it [c] or specify another one [n]?"
            read use_dest_dir
            if  [ "$use_dest_dir" = "c" ] ; then
               echo "Directory /"$dest_dir/" is to be created..."
               mkdir $dest_dir;
               do_backup $dest_dir;
            else check_dest_dir;
            fi
        fi
    }
    
    do_backup(){
        clear
        echo -n "Do the DATABASE dump? [y/n]"
        read do_database_dump
        if [ "$do_database_dump" = "y" ] ; then
          echo "Please enter the required information:"
          echo  -n  "- Database Host (usually localhost): "
          read  dbhost
          echo  -n  "- Database Name: "
          read  dbname
          echo  -n  "- Database User: "
          read  dbuser
          echo  -n  "- Database Password: "
          read  dbpass 
          echo "Creationg database DUMP. Please wait..."
          mysqldump -h DBHOST -u DBUSER -pDBPASS DBNAME > data.sql
          echo "Moving data.sql to your backup directory ($1)"
          mv data.sql $1/
        fi
         
       clear
       echo "TARing MEDIA..."
       tar -cvf media.tar media/*
       echo "Moving media.tar to your backup directory ($1)"
       mv media.tar $1/
      
       clear
       cd app/design/frontend/default/
       echo -n "About to TAR your Theme. What's the name of it?"
       read mytheme
       if [ -d "$mytheme" ]; then
          echo "Specified Theme Directory exists. TARing from app/ ..."
          tar -cvf app.tar $mytheme/
          echo "Moving app.tar to your backup directory ($1)"
          mv app.tar ../../../../$1/
          echo "TARing from skin/..."      
          cd ../../../../skin/frontend/default/
          tar -cvf skin.tar $mytheme/
          echo "Moving skin.tar to your backup directory ($1)"
          mv skin.tar ../../../$1/
       fi
       clear
       echo "Copying local.xml to your backup directory ($1)"
       cd ../../../
       cp app/etc/local.xml $1/
       echo "Copying .htaccess and php.ini to your backup directory ($1)"
       cp .htaccess php.ini $1/
       clear
       cd $1
       echo "Files in your backup:"
       ls     
    }
    
    check_dest_dir;
    

    copy | embed

    1 comment - tagged in  posted by lecomm on Oct 16, 2009 at 7:44 p.m. EDT
  • time machine interval
    $sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 14400
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Sep 17, 2009 at 11:41 a.m. EDT
  • make backup of all my github repos
    #!/bin/bash
    for NAME in backup.pl bmconverter.py convert_encoding.py \
    decay fortune.py git-graph gmail_archive.py liberator \
    mail.pl pdfWriteBookmarks pidgin2adiumlog procimap pyala \
    stoptimer texmf texpreview vimrc; do
        rm -rf $NAME.git
        git clone --bare git://github.com/goerz/$NAME.git $NAME.git
        (cd $NAME.git \
            && git remote add --mirror origin git://github.com/goerz/$NAME.git)
    done
    

    copy | embed

    0 comments - tagged in  posted by goerz on Aug 18, 2009 at 4:17 p.m. EDT
  • Locally backup remote files via ssh
    ssh remote-login@192.168.1.10 "cd /; tar -cvf - / | gzip -c" > backup.tar.gz
    

    copy | embed

    0 comments - tagged in  posted by fraktil on Aug 08, 2009 at 6:55 p.m. EDT
  • Restore and Import MySQL dump
    mysql -u username -ppassword database_name < dump.sql
    

    copy | embed

    0 comments - tagged in  posted by njoubert on Jul 15, 2009 at 3:27 a.m. EDT
  • Backup ALL MySQL DBs
    mysqldump -u username -ppassword –all-databases > dump.sql
    

    copy | embed

    0 comments - tagged in  posted by njoubert on Jul 15, 2009 at 3:26 a.m. EDT
  • Backup and compress a MySQL DB
    mysqldump $DB_NAME -R -q --user=$USER --password=$PASSWORD --lock-tables | gzip > $BACKUPDIR/$BACKUPNAME
    

    copy | embed

    0 comments - tagged in  posted by njoubert on Jul 14, 2009 at 8:59 p.m. EDT
  • backup production to local machine (supports multistage)
    # adapted from http://blog.caboo.se/articles/2006/12/28/a-better-capistrano-backup
    # supports multistage deploy setup
    # allows for restore and local database imports
    
    namespace :db do
      desc "Copy the remote production database to the local development machine" 
      task :backup, :roles => :db, :only => { :primary => true } do
        get("#{shared_path}/config/database.yml", "tmp/#{stage}-database.yml")
        
        filename = "#{application}_#{Time.now.strftime("%Y%m%d_%H%M%S")}.sql.bz2" 
        backupfile = "#{shared_path}/tmp/#{filename}" 
        
        config = YAML::load_file("tmp/#{stage}-database.yml")["#{rails_env}"]
        
        on_rollback { run "rm #{filename}" }
        run "mysqldump -u'#{config["username"]}' -p'#{config["password"]}' -h'#{config["host"]}' '#{config["database"]}'  | bzip2 -c > #{backupfile}"
        
        `mkdir -p #{File.dirname(__FILE__)}/../backups/#{stage.to_s}`
        get backupfile, "backups/#{stage.to_s}/#{filename}" 
        
        run "rm #{backupfile}" 
        run_locally("rm tmp/#{stage}-database.yml")
      end
      
      desc "Restore the local backup to the production database"
      task :restore_backup, :roles => :db, :only => { :primary => true } do
        backupfile = `ls -tr backups/#{stage.to_s} | tail -n 1`.chomp
        restorefile = "/tmp/restore_#{application}_#{Time.now.strftime("%Y%m%d_%H%M%S")}.sql"
        if backupfile.empty?
          logger.important "No backups found" 
        else
          logger.debug "Loading #{backupfile} into remote database on #{stage.to_s.upcase}"
          upload("backups/#{stage.to_s}/#{backupfile}", "#{restorefile}.bz2")
          database_yml = ""
          data = capture "cat #{shared_path}/config/database.yml"
          config = YAML::load(data)['production']
          mysql_import = "bzip2 -d #{restorefile}.bz2 && mysql -u #{config['username']} -p'#{config['password']}' -h #{config['host']} #{config['database']} < #{restorefile}"
          # surpress debug log output to hide the password
          current_logger_level = self.logger.level
          logger.debug %(executing "#{mysql_import.sub(/-p\S+/, '-p')}")
          self.logger.level = Capistrano::Logger::INFO
          run mysql_import do |channel, stream, data|
            puts data 
          end
          # restore logger level
          self.logger.level = current_logger_level
          run "rm #{restorefile}" 
          logger.debug "command finished" 
        end
      end
    
      desc "Import the latest backup to the local development database" 
      task :import_backup do
        backupfile = `ls -tr backups/#{stage.to_s} | tail -n 1`.chomp
        if backupfile.empty?
          logger.important "No backups found" 
        else
          config = YAML::load(ERB.new(IO.read(File.join(File.dirname(__FILE__), 'database.yml'))).result)['development']
          logger.debug "Loading backups/#{stage.to_s}/#{backupfile} into local development database" 
          `bzip2 -cd backups/#{stage.to_s}/#{backupfile} | mysql -u #{config['username']} --password=#{config['password']} #{config['database']}`
          logger.debug "command finished" 
        end
      end
    
      desc "Backup the remote production database and import it to the local development database" 
      task :backup_and_import do
        backup
        import_backup
      end
    end
    
    ## NOTE: remove #{stage.to_s} from filename 
    ## if you don't have multistage deploy env
    

    copy | embed

    0 comments - tagged in  posted by melzz on Jun 26, 2009 at 8:56 p.m. EDT
  • save and restore the list of installed packages
    dpkg --get-selections > selections.txt
    
    dpkg --set-selections < selections.txt
    dselect update
    apt-get dselect-upgrade
    

    copy | embed

    0 comments - tagged in  posted by einalex on May 28, 2009 at 7:01 a.m. EDT
  • automated cron website & mysql backup through email
    #!/bin/bash
    # cron_backup_1.2_without_mutt, Derrick Lo, 28-Aug-2005
    # Modified, Calvin Hill, 21-Oct-2008 (backup entire website, setting filenames based of dbname and websitename variables)
    #
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # INSTRUCTIONS:
    # 1) This program works for CPanel on Linux/Unix operating systems and requires
    #    Linux commands such as such as gzip, tar, (mutt), uuencode, mail and mysqldump.
    # 2) Set the variables - DBNAME, DBPASS, DBUSER, EMAIL.
    # 3) Can use a free email for the EMAIL variable, as the file may be huge. E.g. Yahoo!
    #    Mail or GMail.
    # 4) Upload this program file into /home/{yoursite}/etc/cron_backup.sh private dir;
    #    not in dir like /home/{yoursite}/www/cron_backup.sh where everyone can access.
    # 5) Chmod (change the file permissions of) cron_backup.sh to 711 (-rwx--x--x).
    # 6) Setup a cron job to auto execute this program. See
    #    http://en.wikipedia.org/wiki/Cron on how to do this, if you do not know.
    #
    # TIPS:
    # 1) TO TEST: Set cron schedule to "* * * * *", it will run EVERY minute.
    #    Note that your web host time may be different from your LOCAL time.
    #    Comment out "rm $STATUS" at end of this file.
    # 2) FOR PRODUCTION: Set cron schedule to "55 23 * * *" the suggested backup time.
    #    Daily backup at 23:55 hour, web host time.
    #    Uncomment "rm $STATUS" at end of this file.
    # 3) Test backup data by doing a database restore on another PARALLEL/TEST
    #    website using CPanel phpMyAdmin.
    # 4) Login EMAIL once a while (e.g. every 6 months) to delete redundant backups
    #    to free up space.
    # 5) Ask for help or discuss your solutions at the Mambo forum at
    #    http://forum.mamboserver.com/showthread.php?p=262460#post262460.
    #
    
    DATE=`date +%Y%m%d`
    DBNAME=
    DBPASS=
    DBUSER=
    WEBSITENAME=
    
    #Keep the " around your address
    EMAIL=""
    
    ###No editing beyond here required, unless testing###
    
    WWWDIR=./public_html
    ETCDIR=./bak
    STATUS=$ETCDIR/status.txt
    
    MySQLFILE=$ETCDIR/$DBNAME-bak-$DATE.sql.gz
    BACKUPFILE=$ETCDIR/$WEBSITENAME-backup-$DATE.tar.gz
    
    if [ -f $STATUS ]; then
    	date >> $STATUS
    	echo "Already completed cron job. Please manually delete $STATUS to reset for testing."
    
    else
    	date >> $STATUS
    
    	mysqldump --opt --quote-names -u $DBUSER -p$DBPASS $DBNAME | gzip > $MySQLFILE
    	echo 'Your website database backup is attached.' | mutt -a $MySQLFILE $EMAIL -s "$WEBSITENAME MySQL Database Backup $DATE"
            mv $MySQLFILE $ETCDIR/$DBNAME-bak.sql.gz
    	#rm $MySQLFILE
    
    	tar -zcf $BACKUPFILE $WWWDIR
    	echo 'Your website files backup is attached.' | mutt -a $BACKUPFILE $EMAIL -s "$WEBSITENAME Website Backup $DATE"
    	mv $BACKUPFILE $ETCDIR/$WEBSITENAME-backup.tar.gz
            #rm $BACKUPFILE
    
    	#FOR TESTING:
    	#Program will run within the next minute and will set the status.txt flag.
    	#It will only run again when you manually delete the status.txt file.
    	#Comment the following line and set cron schedule to "* * * * *". Undo both after test.
    	#rm $STATUS
    fi
    

    copy | embed

    1 comment - tagged in  posted by calvinhi on Apr 27, 2009 at 3:32 p.m. EDT
  • Database backup
    DECLARE @currentday varchar(10)
    set @currentday = datepart(day,getdate())
    IF LEN(@currentday) = 1
    BEGIN
    SET @currentday = '0' + @currentday
    END
    declare @currentmonth varchar(10)
    set @currentmonth = datepart(month,getdate())
    IF LEN(@currentmonth) = 1
    BEGIN
    SET @currentmonth = '0' + @currentmonth 
    END
    declare  @currentyear varchar(10)
    set @currentyear = datepart(year,getdate())
    DECLARE @fileName varchar(100)
    SET @fileName = 'c:\Backups\Database\myDatabase_' + @currentyear  + '_' + @currentmonth  + '_' + @currentday  + '.bak'
    BACKUP DATABASE myDatabase TO  DISK = @fileName WITH NOFORMAT, INIT,
    NAME = N'myDatabase -Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
    GO
    

    copy | embed

    0 comments - tagged in  posted by minhnd on Apr 22, 2009 at 10:03 a.m. EDT
Sign up to create your own snipts, or login.