<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; date</title> <atom:link href="http://www.ghacks.net/tag/date/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Sat, 11 Feb 2012 09:52:46 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Setting your computer time in Ubuntu</title><link>http://www.ghacks.net/2010/10/05/setting-your-computer-time-in-ubuntu/</link> <comments>http://www.ghacks.net/2010/10/05/setting-your-computer-time-in-ubuntu/#comments</comments> <pubDate>Tue, 05 Oct 2010 13:58:56 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[date]]></category> <category><![CDATA[GNOME]]></category> <category><![CDATA[ntp]]></category> <category><![CDATA[time]]></category> <category><![CDATA[ubuntu]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=35576</guid> <description><![CDATA[You computer&#8217;s clock does more than just tell you the time. This clock also stamps your email with the correct time as well as documents and much more. So when your PC clock is off, your life is off (at least while you are working). So it is necessary to keep your machine time accurate. [...]]]></description> <content:encoded><![CDATA[<p>You computer&#8217;s clock does more than just tell you the time. This clock also stamps your email with the correct time as well as documents and much more. So when your PC clock is off, your life is off (at least while you are working). So it is necessary to keep your machine time accurate. But how do you do this? Besides making sure your hardware clock is correct (which is commonly done through the BIOS settings), you need to know how to set the time.</p><p>In this article I am going to show you how to change the time on your Ubuntu machine using both the GUI and the command line. Hopefully, when you&#8217;re done with this, your computer clock will always be accurate.</p><p><span
id="more-35576"></span><strong>Another option</strong></p><p>Of course there is always another option. You can always set up NTP on your machine. I have already covered this in my article &#8220;<a
title="Installing and configuring NTP on Linux" href="http://www.ghacks.net/2009/03/16/installing-and-configuring-ntp-on-linux/" target="_blank">Installing and configuring NTP on Linux</a>&#8220;. That is, by far, the most reliable way to manage your clock. But when you don&#8217;t have constant access to the internet, or you simply don&#8217;t want to install a daemon on your machine &#8211; you have to resort to other methods. Let&#8217;s take a look at them here.</p><p><strong>Command line</strong></p><p>In order to set the date from the command line, you use the <em>date</em> command. The date command, however, is not the simplest command to figure out &#8211; at least not from the man page. If you look at the man page for <em>date</em> you see the time format uses a specific time string format like:</p><p><em>MMDDhhmmYYYY.ss</em></p><p>What the above string means is:</p><p><em> </em></p><p><em> </em></p><p><em> </em></p><ul><li>MM<span
style="font-style: normal"> is a two digit month, between 01 to 12.</span></li><li>DD<span
style="font-style: normal"> is a two digit day, between 01 and 31. NOTE: Regular rules for days, according to month and year, apply.</span></li><li><span
style="font-style: normal"><em>hh</em> is two digit hour, using the 24-hour period so it is between 00 and 23.</span></li><li><span
style="font-style: normal"><em>mm</em> is two digit minute, between 00 and 59.</span></li><li>YYYY<span
style="font-style: normal"> is the year; it can be two digit or four digit: your choice. </span></li><li><span
style="font-style: normal"><em>ss</em> is two digit seconds. The period (&#8220;.&#8221;) before the ss is necessary.</span></li></ul><p>So, let&#8217;s say you want to set the correct date and time for this exact moment (the moment I am writing, not your reading). To do this I would enter the command:</p><p><code>sudo date 100507492010.00</code></p><p>at which point you would be returned:</p><p><code>Tue Oct 5 07:50:00 EDT 2010</code></p><p><strong>GUI</strong></p><div
id="attachment_35589" class="wp-caption alignleft" style="width: 310px"><a
href="http://www.ghacks.net/wp-content/uploads/2010/10/time_date_gui.png"><img
class="size-medium wp-image-35589 " src="http://www.ghacks.net/wp-content/uploads/2010/10/time_date_gui-500x294.png" alt="" width="300" height="176" /></a><p
class="wp-caption-text">Figure 1</p></div><p>Now, let&#8217;s take a look and see how this is done from the graphical front end. To do this click <strong>System &gt; Administration &gt; Time and Date</strong>. When you do this you will have to click the &#8220;lock&#8221; button to unlock this tool for changes. When you click this you will have to enter your sudo password. Upon proper authentication you will then be able to use the drop downs for hours, minutes, and seconds. When you change the time, you only need to close the tool, no saving required. NOTE: You can also change the date as well as the timezone with this same tool.</p><p><strong>Final thoughts</strong></p><p>Don&#8217;t be caught in the future or the past on Linux. Make sure your time is correct so you aren&#8217;t confusing those receiving your emails (unless you want them to think they are receiving emails from &#8220;future you&#8221;.)</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2010/10/05/setting-your-computer-time-in-ubuntu/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Back up your Apache web directory and database with this simple script</title><link>http://www.ghacks.net/2009/01/22/back-up-your-apache-web-directory-and-database-with-this-simple-script/</link> <comments>http://www.ghacks.net/2009/01/22/back-up-your-apache-web-directory-and-database-with-this-simple-script/#comments</comments> <pubDate>Thu, 22 Jan 2009 18:58:34 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[automated backups]]></category> <category><![CDATA[backup-solution]]></category> <category><![CDATA[backups]]></category> <category><![CDATA[cat]]></category> <category><![CDATA[cron]]></category> <category><![CDATA[date]]></category> <category><![CDATA[LAMP]]></category> <category><![CDATA[tar]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=10060</guid> <description><![CDATA[I administer a lot of web sites. And all of these web sites need backup solutions. Since most of those web sites use LAMP servers it only made sense to set up a backup system using the available, included open source tools. It didn&#8217;t take long to create a solid backup system and, with the [...]]]></description> <content:encoded><![CDATA[<p>I administer a lot of web sites. And all of these web sites need backup solutions. Since most of those web sites use LAMP servers it only made sense to set up a backup system using the available, included open source tools. It didn&#8217;t take long to create a solid backup system and, with the help of cron, automate that system so that Apache&#8217;s document root and the website databases were backed up regularly and without user intervention.</p><p>The script made use of the following tools: date, cat, tar, mv, and rm. That&#8217;s it. The script will create backups with the date in the file name and then move the backups to a central location. Without further adieu, let&#8217;s get to the script.</p><p><span
id="more-10060"></span><em>#! /bin/sh</em></p><p><em>TMP=&#8221;/tmp/&#8221;</em></p><p><em>#Format the date in YEAR-MO-DY format<br
/> TODAY=`date +%F`</em></p><p><em># Check to see if there is a lastbackup file in /tmp, if not create it,<br
/> # if so then set LAST equal to $TODAY<br
/> if [ -f /tmp/lastbackup ]; then<br
/> LAST=`cat /tmp/lastbackup`<br
/> else<br
/> LAST=$TODAY<br
/> fi</em></p><p><em># Set the web directory backup name to the following<br
/> WEB_FILENAME=&#8221;inc-&#8221;$TODAY&#8221;-web.tar.gz&#8221;</em></p><p><em># Set database backup name to the following<br
/> DB_FILENAME=&#8221;inc-&#8221;$TODAY&#8221;-db.tar.gz&#8221;</em></p><p><em># this tars up my web directory into web.tar.gz tarball.<br
/> /bin/tar -czf $TMP$WEB_FILENAME &#8211;after-date=$LAST /var/www/html</em></p><p><em># Move the web back to the backup directory<br
/> /bin/mv $TMP$WEB_FILENAME /data</em></p><p><em># Remove web backup file from temp director<br
/> rm $TMP$WEB_FILENAME</em></p><p><em># this tars up my database directory into $TODAY-db.tar.gz tarball.<br
/> /bin/tar -czf $TMP$DB_FILENAME &#8211;after-date=$LAST /var/lib/mysql</em></p><p><em># Move the backup database to the backup directory<br
/> /bin/mv $TMP$DB_FILENAME /data</em></p><p><em># Remove web backup file from temp directory<br
/> rm $TMP$DB_FILENAME<br
/> </em></p><p>What I wanted this to do is create daily backups and move the backups to the <strong>/data</strong> directory on the drive housing the server. These backups will be saved for one month. After the month is completed i have a second script that deletes the months backups prior to running the next backup (so there is always a backup to fall to). How I made use of this script is simple. I save the script (called <strong>backup.sh</strong>) in the root user directory and create a second script called <strong>rm_backups.sh</strong> that looks like this:</p><p><em>#! /bin/sh</em></p><p><em>rm /data/*gz</em></p><p>With these two files in place I create two cron entries. The first cron entry is for running the <strong>backup.sh</strong> script and looks like:</p><p>0 23 * * *     ~/backup.sh</p><p>The second cron entry is for running the <strong>rm_backups.sh</strong> script and looks like:</p><p>0 20 1 * *     ~/rm_backups.sh</p><p>Both of the above cron jobs are created as the root user.</p><p><strong>Final Thoughts</strong></p><p>Naturally this solution could be easily modified (using such tools rsync) to set up an offsite backup solution. What should be obvious is that creating a simple, flexible server backup system on Linux is easy. With the help of a little ingenuity, you can create your own automated backup service.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/01/22/back-up-your-apache-web-directory-and-database-with-this-simple-script/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
