<?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; cron</title> <atom:link href="http://www.ghacks.net/tag/cron/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>Fri, 10 Feb 2012 09:07:37 +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>Schedule cron jobs with this easy to use GUI</title><link>http://www.ghacks.net/2011/03/09/schedule-cron-jobs-with-this-easy-to-use-gui/</link> <comments>http://www.ghacks.net/2011/03/09/schedule-cron-jobs-with-this-easy-to-use-gui/#comments</comments> <pubDate>Wed, 09 Mar 2011 20:18:36 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Desktop Manager]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[cron]]></category> <category><![CDATA[GNOME]]></category> <category><![CDATA[job scheduler]]></category> <category><![CDATA[schedule jobs]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=42312</guid> <description><![CDATA[Whenever I try to explain using cron to schedule jobs, new Linux users cringe at the thought of learning yet another command line tool. That&#8217;s a shame, because cron is an incredibly handy tool to have in your toolbox. But just because you fear the command line, doesn&#8217;t mean you don&#8217;t get to take advantage [...]]]></description> <content:encoded><![CDATA[<p>Whenever I try to explain using cron to schedule jobs, new Linux users cringe at the thought of learning yet another command line tool. That&#8217;s a shame, because cron is an incredibly handy tool to have in your toolbox. But just because you fear the command line, doesn&#8217;t mean you don&#8217;t get to take advantage of cron. With the help of a user-friendly GUI, you too can have cron scheduling automatic jobs for you.</p><p>With <a
title="GNOME Schedule" href="http://gnome-schedule.sourceforge.net/" target="_blank">GNOME Schedule</a>, you can create a one-time cron job, recurring cron jobs, or cron jobs from templates. Let&#8217;s dig into the installation and usage of this tool.</p><p><span
id="more-42312"></span><strong>Installation</strong></p><p>Installing GNOME Schedule is simple, if you follow these steps, you will have this application installed in no time.</p><ol><li>Open up the Add/Remove Software utility (Such as Ubuntu Software Center).</li><li>Search for &#8220;jobs&#8221; (no quotes).</li><li>Mark the Schedule Tasks application for installation.</li><li>Click Appy to install.</li><li>Accept any dependencies that might be necessary for installation.</li><li>Allow the installation to complete.</li><li>Close the Add/Remove Software utility.</li></ol><p>Once installed, you will find GNOME Schedule in Applications &gt; System Tools &gt; Scheduled Tasks.</p><p><strong>Usage</strong></p><div
id="attachment_42313" class="wp-caption alignleft" style="width: 340px"><a
href="http://www.ghacks.net/wp-content/uploads/2011/03/gnome_schedule_main.png"><img
class="size-medium wp-image-42313 " src="http://www.ghacks.net/wp-content/uploads/2011/03/gnome_schedule_main-550x332.png" alt="" width="330" height="199" /></a><p
class="wp-caption-text">Figure 1</p></div><p>The usage of GNOME Schedule is simple. When you open up the main window (see Figure 1). Let&#8217;s walk through the steps for creating a recurring cron job.</p><p>Step 1: Click the new drop-down (downward pointing arrow associated with the New button) and select Recurrent Task.</p><div
id="attachment_42314" class="wp-caption alignright" style="width: 160px"><a
href="http://www.ghacks.net/wp-content/uploads/2011/03/gnome_schedule_recurrent.png"><img
class="size-full wp-image-42314  " src="http://www.ghacks.net/wp-content/uploads/2011/03/gnome_schedule_recurrent.png" alt="" width="150" height="197" /></a><p
class="wp-caption-text">Figure 2</p></div><p>Step 2: In the resulting window (see Figure 2) fill out all of the information necessary to create the job. The information necessary will be: Description (a name for the job), Command (the command you want to run as the recurring task), Behavior (Do you want to suppress command output, is this an X Application, etc.), Basic (Is this task to run every minute, hour, day, week, or month), Advanced (schedule the job for a specific time).</p><p>After this information is complete, click the Add button and the job will be created and scheduled.</p><p>If you look at the bottom of the scheduled task window, you will notice the Add as Template button. You can add this job as a template if it is a job you can easily base other jobs on. If you create template jobs, you can then create a new job based on that template, by click the New drop-down and selecting From Template.</p><p>Now, if you want to create cron jobs that need root (or sudo) permissions, you will need to run the tool like so:</p><ol><li>Open a terminal window.</li><li>Issue the command <em>sudo gnome-schedule</em> (if you are using a non-sudo distribution, su to the root user and issue the command <em>gnome-schedule</em>).</li><li>Schedule the job as described above.</li></ol><p>You will notice, when running in super user mode, you have an extra button &#8211; the change user button. This will allow you to schedule a cron job for any user on the system (so long as they have the ability to schedule jobs.)</p><p>Final thoughts</p><p>Gnome Schedule is a very easy way to allow new users to take advantage of the powerful cron tool, without having to learn the command line version. I recommend learning the command line for cron, but for those who don&#8217;t have the time or inclination, this is a good route to take.</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2011/03/09/schedule-cron-jobs-with-this-easy-to-use-gui/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Linux Back In Time: Backup made easy</title><link>http://www.ghacks.net/2009/10/10/linux-back-in-time-backup-made-easy/</link> <comments>http://www.ghacks.net/2009/10/10/linux-back-in-time-backup-made-easy/#comments</comments> <pubDate>Sat, 10 Oct 2009 17:00:23 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Desktop Manager]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[auto backups]]></category> <category><![CDATA[backups]]></category> <category><![CDATA[cron]]></category> <category><![CDATA[desktop backup]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=17123</guid> <description><![CDATA[In my recent trend of covering Linux backup tools I have, so far, covered Flyback (&#8220;Quick and easy backups with Flyback&#8220;) and Backerupper (&#8220;Simple gui backup tool Backerupper&#8220;). Both tools are GUI tools that make the process of backing up your Linux files and folders a simple task. This time around I want to add [...]]]></description> <content:encoded><![CDATA[<p>In my recent trend of covering Linux backup tools I have, so far, covered Flyback (&#8220;<a
title="Flyback" href="http://www.ghacks.net/2009/10/08/quick-and-easy-backups-with-flyback/" target="_blank">Quick and easy backups with Flyback</a>&#8220;) and Backerupper (&#8220;<a
title="Backerupper" href="http://www.ghacks.net/2009/10/09/simple-gui-backup-tool-backerupper/" target="_blank">Simple gui backup tool Backerupper</a>&#8220;). Both tools are GUI tools that make the process of backing up your Linux files and folders a simple task. This time around I want to add to this growing list of user-friendly backup tools <a
title="Back in time" href="http://backintime.le-web.org/" target="_blank">Back In Time</a>.</p><p>Back In Time offers two GUI versions: One for GNOME and one for KDE. If you want to run the KDE version of the tool you will have to be running KDE &gt;= 4.1. The difference between the GUIs is minimal, and there are no features on one that are on the other (it&#8217;s all in the different widget sets used.) <span
style="background-color: #ffffff">In this tutorial you will learn how to install and use the Back In Time backup tool.</span></p><p><span
style="background-color: #ffffff"><span
id="more-17123"></span><strong>Installation</strong></span></p><p><span
style="background-color: #ffffff">Installing Back In Time is simple. Go to the applications&#8217; <a
title="Back In Time Download Page" href="http://backintime.le-web.org/download_page/" target="_blank">download page</a> and download the necessary files. If you are installing on Ubuntu you will need:</span></p><p><span
style="background-color: #ffffff"><a
title="backintime-common" href="http://backintime.le-web.org/download/backintime/backintime-common-0.9.26_all.deb" target="_blank">backintime-common</a></span></p><p><span
style="background-color: #ffffff">and either:</span></p><p><span
style="background-color: #ffffff"><a
title="backintime-gnome" href="http://backintime.le-web.org/download/backintime/backintime-gnome-0.9.26_all.deb" target="_blank">backintime-gnome</a></span></p><p><span
style="background-color: #ffffff">or</span></p><p><span
style="background-color: #ffffff"><a
title="backintime-kde" href="http://backintime.le-web.org/download/backintime/backintime-kde4-0.9.26_all.deb" target="_blank">backintime-kde</a></span></p><p>Before you can install this application you will need to first install the meld tool. To do this issue the command:</p><p><em>sudo apt-get install meld</em></p><p><span
style="background-color: #ffffff">Once Meld is installed you can install Back In Time. To do this you just need to open up a terminal window, change to the directory you downloaded the files into, and issue the command:</span></p><p><span
style="background-color: #ffffff"><em>sudo dpkg -i backintime*</em></span></p><p>which will install both necessary files.</p><p>After the application is installed you are ready to start backing up.</p><p><strong>Usage</strong></p><p>To start up Back In Time go to the System Tools sub-menu of the Applications menu. There ar two entries: Back In Time and Back  In Time (root). You will want to run the non-root entry to back up your standard files.</p><div
id="attachment_17131" class="wp-caption alignleft" style="width: 250px"><a
rel="attachment wp-att-17131" href="http://www.ghacks.net/2009/10/10/linux-back-in-time-backup-made-easy/backintime_settings/"><img
class="size-thumbnail wp-image-17131 " src="http://www.ghacks.net/wp-content/uploads/2009/10/backintime_settings-300x300.png" alt="Figure 1" width="240" height="240" /></a><p
class="wp-caption-text">Figure 1</p></div><p>When you fire up Back In Time for the first time you will be greeted, not with the main window, but the Settings Window (see Figure 1).  Before you can actually set up a back up you have to configure a backup directory. This is done in the General tab of the Settings window.</p><p>By default the Schedule will be disabled. This is fine if you want to do a one-time backup. But for scheduled backups you will need to select a frequency from the Schedule drop down.</p><p>You will also have to add at least one folder to back up. To do this go to the Include tab and add a directory to be backed up. You can, of course, add more than one directory to back up.</p><p>From within the Auto-remove tab in the Settings window there is a setting I highly recommend. If you check the &#8220;Smart Remove&#8221; check box Back In Time will:</p><ul><li><span
style="background-color: #ffffff">Keep all snapshots from today and yesterday.</span></li><li><span
style="background-color: #ffffff">Keep one snapshot from last week and one from two weeks prior.</span></li><li><span
style="background-color: #ffffff">Keep one snapshot per month for all previous months of the year.</span></li><li><span
style="background-color: #ffffff">Keep one snapshot per year for all previous years.</span></li></ul><p><span
style="background-color: #ffffff">If you have any need to retain snapshots, this is a fairly safe bet.</span></p><p><span
style="background-color: #ffffff">From within the Exclude tab you can configure Back In Time for folders and/or files to not include in the backup. You can also add patterns to exclude, which can include wildcards.</span></p><p><span
style="background-color: #ffffff">After you have all of your settings taken care of click OK and Back In Time is set up and ready to go. </span></p><p><span
style="background-color: #ffffff"><strong>What about that scheduled backup?</strong></span></p><p>Here&#8217;s the deal &#8211; Back In Time does not have a Panel icon to keep the application running in the background. So unless you plan on keeping the application open, you have to have another means to make sure your backups happen.  In order to do this you have to know the command line portion of the tool. And then you will need to add the right command as a cron job. Without getting too complicated, the command to run Back In Time from the command line will be:</p><p><em>backintime -b</em></p><p>Which will back up any necessary job you have created.</p><p>With that in mind you can set up the <em>backintime</em> command to be run from your crontab. Say, for example, you want your backintime job to run every Sunday. You could enter a cronjob (started by issuing the command <em>crontab -e</em>) and enter a job like:</p><p><em>* * * * 7 /usr/bin/backintime -b</em></p><p>Save that cron job and it will be set up to run every Sunday.</p><p><strong>Final thoughts</strong></p><p>Back In Time is just as user-friendly as the other backup tools and adds a command line tool for added flexibility. I highly recommend Back In Time for your simple desktop backup jobs.</p><p><span
style="background-color: #ffffff"> </span></p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/10/10/linux-back-in-time-backup-made-easy/feed/</wfw:commentRss> <slash:comments>1</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> <item><title>Using Cron to Automate Linux Tasks</title><link>http://www.ghacks.net/2009/01/11/using-cron-to-automate-linux-tasks/</link> <comments>http://www.ghacks.net/2009/01/11/using-cron-to-automate-linux-tasks/#comments</comments> <pubDate>Sun, 11 Jan 2009 21:32:12 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[automated tasks]]></category> <category><![CDATA[cron]]></category> <category><![CDATA[cron job]]></category> <category><![CDATA[crontab]]></category> <category><![CDATA[script automation]]></category> <category><![CDATA[vi]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=9823</guid> <description><![CDATA[Linux is one of the most flexible and useful operating systems available. One of the tools that places Linux at the top of the flexibility and usability scale is cron. The cron system allows you to automate tasks without the aid of third party software. But because few know how to use cron, it seems [...]]]></description> <content:encoded><![CDATA[<p>Linux is one of the most flexible and useful operating systems available. One of the tools that places Linux at the top of the flexibility and usability scale is cron. The cron system allows you to automate tasks without the aid of third party software. But because few know how to use cron, it seems too complex to bother with. Not so. The cron system is actually quite easy to use. Let&#8217;s take a look at cron.</p><p>The cron system works by reading various crontab files either found in a users&#8217; directory or within the <strong>/etc </strong>directory. These cron files can be edited with either the <em>crontab</em> command or by editing the various files within <strong>/etc</strong>. Only the root user can edit the <strong>/etc</strong> files because those files (found in the subdirectories <strong>/etc/cron.d, /etc/cron.daily, /etc/cron.hourly, /etc/cron.weekly, /etc/cron.monthly</strong>) are used for system services.  Instead of focusing on system services, I will illustrate how to automate the execution of a user-created bash script.</p><p><span
id="more-9823"></span>This imaginary bash script will be called <em>myscript.sh</em>. This script will be housed in <strong>/home/jlwallen/ </strong>and will have executable permission (by way of <em>chmod u+x myscript.sh</em>).  What we want to do is automate the execution of this script so that it executes once per day at the same time every day (we&#8217;ll say 7am).</p><p>Before we get into editing with crontab we first need to chat about how cron views time.The cron system looks at time like this:</p><ul><li><em>Minute(0-59)</em></li><li><em>Hour (0-23)</em></li><li><em>Day of the month (1-31)</em></li><li><em>Month (1-12)</em></li><li><em>Day of the week (0-6 with Sunday being 0)</em></li></ul><p>The structure of cron time looks like this:</p><p>Minute Hour Day of month Month Day of the week</p><p>The trick for cron is that when you do not have an entry for a section you add an &#8220;*&#8221;. So the time entry for a cron job that should run at 7am every day of the week would look like:</p><p><em>0 7 * * * </em></p><p>That is not the complete cron entry, just the time portion. Now, on to editing with crontab.</p><p><strong>Crontab</strong></p><p>Users edit their cron entries with the <em>crontab</em> command. The crontab command has a few switches:</p><ul><li>e &#8211; Edit your crontab</li><li>l &#8211; List your crontab</li><li>r &#8211; Delete all crontab entries</li></ul><p>To add a new crontab entry enter the command <em>crontab -e</em> which will place you in the vi text editor with your user crontab file opened. If you&#8217;re not familiar with vi I&#8217;ll give you the crash course as we edit the crontab.</p><p>First click the &#8220;i&#8221; key to go into the insert mode. You can now add text. Enter the cron entry to run the myscript.sh every day at 7am. This entry will look like:</p><p>* 7 * * * ~/myscript.sh</p><p>Now hit the Esc key to get out of the insert mode. Once out of insert mode you need to write the file and quite crontab. To do this hit the &#8220;:&#8221; key followed by &#8220;wq&#8221; (for write and quite). Finish the job by hitting the Enter key.</p><p>You should see &#8220;crontab: installing new crontab&#8221; at your bash prompt.</p><p>Congratulations, you&#8217;ve just created your first cron job!</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/01/11/using-cron-to-automate-linux-tasks/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
