<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel>
	  <title>Ask MetaFilter questions tagged with cron</title>
      <link>http://ask.metafilter.com/tags/cron</link>
      <description>Questions tagged with 'cron' at Ask MetaFilter.</description>
	  <pubDate>Sat, 05 Dec 2009 12:29:34 -0800</pubDate> <lastBuildDate>Sat, 05 Dec 2009 12:29:34 -0800</lastBuildDate>

      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>	  
	<item>
	<title>How to automate backups on my ftp server?</title>
	<link>http://ask.metafilter.com/139885/How%2Dto%2Dautomate%2Dbackups%2Don%2Dmy%2Dftp%2Dserver</link>	
	<description>I have some wordpress sites hosted at bluehost that I want to keep backed up. Can you help me automate this? Detailed needs inside. What I&apos;ve been doing is going to the bluehost control panel every few weeks and manually downloading, first, all the files on the ftp server. Then I&apos;m separately downloading all the dbs. Then I&apos;m throwing them all in a folder on my local machine and have Carbonite back them up remotely. I keep five backup sets, and delete the oldest when I add a new one.&lt;br&gt;
&lt;br&gt;
I would like to automate this 100% if possible -- maybe have some kind of script that every week zips up the backups into a one big file on the ftp server, which I can then use SynchBack Pro to mirror to my local HD on a regular basis? &lt;br&gt;
&lt;br&gt;
The solution would have to compress all the dbs and a defined portion of the ftp file structure into one file named 120509.* (itself inside a folder called /backups). The following week, same exact thing, except the files are compressed into 121209.*, etc. Each week it should look in /backups for a file named with a date older than 5 weeks and delete it. &lt;br&gt;
&lt;br&gt;
Then I would use Synchback every week to pull down the contents of /backups on the ftp server to my local drive, which I will tell Carbonite to pull up remotely.&lt;br&gt;
&lt;br&gt;
What do I do to automate the compressing and saving and sequential naming and date-based deleting on the ftp server? &lt;br&gt;
&lt;br&gt;
I&apos;ve never used cron or SSH and only done super basic stuff using phpmysql. I&apos;ve read through &lt;a href=&quot;http://ask.metafilter.com/116450/How-do-I-automatically-backup-a-website-files-and-database-to-a-Mac&quot;&gt;these &lt;/a&gt;&lt;a href=&quot;http://ask.metafilter.com/18690/Automatic-mySQL-backup&quot;&gt;two &lt;/a&gt;askmes and while they did include code snippets that seemed like what I needed, I don&apos;t know what to do with them or how to modify them to do what I specifically need. So speak very slowly. Thanks!</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2009:site.139885</guid>
	<pubDate>Sat, 05 Dec 2009 12:29:34 -0800</pubDate>
	<category>backup</category>
	<category>bluehost</category>
	<category>cron</category>
	<category>ftp</category>
	<category>mysql</category>
	<category>ssh</category>
	<dc:creator>stupidsexyFlanders</dc:creator>
	</item>
	<item>
	<title>PHP -&gt; Twitter API at specified times: what am I Doing Wrong?</title>
	<link>http://ask.metafilter.com/128780/PHP%2DTwitter%2DAPI%2Dat%2Dspecified%2Dtimes%2Dwhat%2Dam%2DI%2DDoing%2DWrong</link>	
	<description>Please help me write a PHP script that publishes Twitter updates at pre-specified times. I&apos;m working on a script that will update Twitter with reminders about upcoming shows at a music festival, building on &lt;strong&gt;lodev&lt;/strong&gt;&apos;s idea &lt;a href=&quot;http://ask.metafilter.com/69022/How-instant-is-a-Twitter-update#1033437&quot;&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
I&apos;ve currently got &lt;a href=&quot;http://pastebin.com/m3f605f0f&quot;&gt;this script&lt;/a&gt;, which calls a text file structured like in this made-up example:&lt;br&gt;
&lt;br&gt;
&lt;tt&gt;XXXUPDATE SponsorCo Stage: THE BEATLES in 30 minutes XXXTIME August 21 2009 21:30 +0200 XXXDONE 0 XXXENDLINE&lt;br&gt;
XXXUPDATE MegaCorp Stage: ROLLING STONES in 30 minutes XXXTIME August 21 2009 22:45 +0200 XXXDONE 0 XXXENDLINE&lt;/tt&gt;&lt;br&gt;
&lt;br&gt;
Proprietary format, I know. :) There are six Twitter accounts right now for separate concert stages, more may follow. &lt;br&gt;
&lt;br&gt;
All six separate scripts are called from a Ruby file via pycron, every minute. I understand that&apos;s plenty often and I don&apos;t really need that kind of temporal resolution, but it uses relatively few processor cycles so I&apos;m not really complaining.&lt;br&gt;
&lt;br&gt;
As you can see in the PHP code:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;if (($now &amp;lt;= ($utime + 30)) &amp;amp;&amp;amp; ($now &amp;gt;= ($utime - 29))) {&lt;br&gt;
if ($update[3] !== 1) {&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
When an update is ready for publication it should, theoretically at least, satisfy the first &quot;if&quot; statement and be published. The second &quot;if&quot; checks a &quot;done&quot; flag in the text file which I have as of yet not used (i.e. they&apos;re all set to 0 and the current code doesn&apos;t amend them).&lt;br&gt;
&lt;br&gt;
Now, I &quot;stress-tested&quot; this with some test updates on all six accounts, including many simultaneous ones (carrying the same timestamp) on the different accounts for ten minutes with six (one for each account) every minute, and out of maybe a hundred-something tweets (I ran multiple iterations of the test) only one was dropped, i.e. it was in the text file but was not published.&lt;br&gt;
&lt;br&gt;
Even one dropped update is unacceptable to me, and I strongly suspect I am Doing It Wrong. But how? The problem basically boils down to the following question:&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;What better method would there be to push out the updates reliably using the server config I currently have (XP, Apache, PHP5, Ruby, pycron), very preferably without using databases?&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;
When it comes to scripting I really only speak PHP and a little JavaScript: even the (very basic) Ruby script was kindly provided to me for a different project.&lt;br&gt;
&lt;br&gt;
So there&apos;s just too little time before the event to learn a new language or start out with MySQL or whatever before the event, and I&apos;m not really eager to change to different software or change my server configuration (or set up another box) just for one-off project that will last just a few days. This is just to say that it&apos;s not due to an unwillingness on my part, but rather due to practical considerations.&lt;br&gt;
&lt;br&gt;
If anyone could offer their insights I would be ever so grateful. Thanks in advance, guys.</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2009:site.128780</guid>
	<pubDate>Wed, 29 Jul 2009 18:29:11 -0800</pubDate>
	<category>api</category>
	<category>code</category>
	<category>coding</category>
	<category>cotweet</category>
	<category>cron</category>
	<category>crontab</category>
	<category>php</category>
	<category>pycron</category>
	<category>resolved</category>
	<category>twitter</category>
	<category>twitterapi</category>
	<dc:creator>goodnewsfortheinsane</dc:creator>
	</item>
	<item>
	<title>Cronjobs</title>
	<link>http://ask.metafilter.com/96099/Cronjobs</link>	
	<description>Cron Jobs - separate processes? This seems a pretty simple question, but I somehow can&apos;t find any info on this: Is every job launched by a (Linux) cron daemon started as a new process? What happens in the (theoretical) case where a repeating tasks overlaps with its own next iteration?</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2008:site.96099</guid>
	<pubDate>Wed, 09 Jul 2008 00:48:01 -0800</pubDate>
	<category>admin</category>
	<category>cron</category>
	<category>linux</category>
	<dc:creator>uncle harold</dc:creator>
	</item>
	<item>
	<title>My website&apos;s scripts eat up too much bandwidth. How do I resolve this?</title>
	<link>http://ask.metafilter.com/87977/My%2Dwebsites%2Dscripts%2Deat%2Dup%2Dtoo%2Dmuch%2Dbandwidth%2DHow%2Ddo%2DI%2Dresolve%2Dthis</link>	
	<description>My site&apos;s cron tasks eat up a &lt;em&gt;lot&lt;/em&gt; of bandwidth. Can I change the paths from http to local? Or can I move the tasks to my home server? One of my websites (the election one) runs a truckload of PHP to parse, mesh, filter, and cache an equally large number of external RSS feeds which are then stored and included in a reasonably lean (~10k) index.html. This creates a strange situation where the bandwidth consumed by the PHP (locally, but via http) far exceeds the actual bandwidth consumed by visitors. My web hosting provider has warned me about the excessive activity, but given the limited number of visitors, upgrading to a hosting deal with a higher bandwidth limit isn&apos;t really worthwhile for me.&lt;br&gt;
&lt;br&gt;
How do I resolve this?&lt;br&gt;
&lt;br&gt;
Current situation: a bunch of &lt;a href=&quot;http://feedforall.com/download.htm&quot;&gt;FeedForAll&lt;/a&gt; PHP scripts are executed using a Ruby-as-CGI script (which &lt;a href=&quot;http://www.metafilter.com/username/wackybrit&quot;&gt;wackybrit&lt;/a&gt; kindly helped me with) called via cron at regular intervals, varying by nature of content: none-time critical content would be updated hourly, whereas latest news etc. is updated every 10 minutes (was 2 minutes, but I took it down a notch for now to avoid further problems with my host). My monthly bandwidth limit is 8 GB; actual visitor usage is a modest fraction of that, but the scripting alone was responsible for 37 GB (!) in March.&lt;br&gt;
&lt;br&gt;
Several options:&lt;br&gt;
&lt;br&gt;
1) The bandwidth is measured by the host using HTTP responses. If I run the scripts using local UNIX paths, e.g. /usr/gnfti/www/ etc., the scripts generate no HTTP headers and thus don&apos;t count towards the quota. Of course they will still incur server load, but I have discussed this with the hosting company and it seems they&apos;re okay with it if I limit the use somewhat as a compromise. But then, not all of these scripts seem to be okay with local paths, most notably the keyword filter (rssFilter.php), which is responsible for 25% of the bandwidth on its own. &lt;br&gt;
&lt;br&gt;
Any ideas how to make it work this way anyway?&lt;br&gt;
&lt;br&gt;
2) I have a home server running &lt;a href=&quot;http://www.wampserver.com/en/&quot;&gt;WAMP&lt;/a&gt; on XP. Could I run the PHP on this box instead and have the output automatically upload to the remote server via FTP? Most of the bandwidth is to do with moving stuff around locally anyway; the actual output is in the order of kilobytes. I imagine this would involve running some sort of cron + FTP client/scheduler on the home box, but my knowledge in this area is limited. &lt;br&gt;
&lt;br&gt;
Could this be done, and if so, how?&lt;br&gt;
&lt;br&gt;
3) Lastly, if you have any suggestions on how to pull this off aside from the examples above, that too would be much appreciated.&lt;br&gt;
&lt;br&gt;
Thanks in advance for any suggestions or insight you might have to offer, guys.</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2008:site.87977</guid>
	<pubDate>Sat, 05 Apr 2008 09:21:43 -0800</pubDate>
	<category>bandwidth</category>
	<category>bandwidthlimit</category>
	<category>cron</category>
	<category>crontab</category>
	<category>feedforall</category>
	<category>ftp</category>
	<category>homeserver</category>
	<category>internet</category>
	<category>php</category>
	<category>rss</category>
	<category>rss2html</category>
	<category>rssfilter</category>
	<category>rssmesh</category>
	<category>script</category>
	<category>scripting</category>
	<category>scripts</category>
	<category>webdesign</category>
	<category>website</category>
	<dc:creator>goodnewsfortheinsane</dc:creator>
	</item>
	<item>
	<title>Help with cron</title>
	<link>http://ask.metafilter.com/68515/httpwwwnataliedeecom071907cronisseriousbusinessjpg</link>	
	<description>How do I make a command-line script run at startup/login in OSX? I want to make rkhunter run while I&apos;m asleep. I&apos;ve found &lt;a href=&quot;http://opensource.weblogsinc.com/2005/12/02/hunt-for-rootkits-with-rkhunter/&quot;&gt; a script&lt;/a&gt; to get it to update, run, and write to a temp logfile, but this howto just tells me to run it as a cron job. I&apos;m trying to figure out &lt;a href=&quot;http://www.unixgeeks.org/security/newbie/unix/cron-1.html&quot;&gt;cron&lt;/a&gt;, but &lt;i&gt;that&lt;/i&gt; tutorial tells me to run &lt;i&gt;sudo cron&lt;/i&gt; as a startup script. That&apos;s what I want to use cron for! &lt;br&gt;
&lt;br&gt;
What do I have to do to get the cron daemon going every time I log in? Both short answers and links to long, way-too-much-information texts are welcome.</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2007:site.68515</guid>
	<pubDate>Fri, 03 Aug 2007 19:41:52 -0800</pubDate>
	<category>cron</category>
	<category>cron-is-serious-business</category>
	<category>osx</category>
	<category>osxstartupscript</category>
	<category>startupscript</category>
	<dc:creator>tylermoody</dc:creator>
	</item>
	<item>
	<title>Questions about cron</title>
	<link>http://ask.metafilter.com/57432/Questions%2Dabout%2Dcron</link>	
	<description>Paging Linux geeks -- please teach me the inner mysteries of cron and scripting.  Simple questions follow. Right now I have a Windows machine that downloads information off the web every hour.  This computer is a 10-year old notebook computer that&apos;s about to fall apart, and I have a new computer on the way to replace it.  I badly need a Linux system to run some institutional science apps, so it looks like I should go the Linux route.&lt;br&gt;
&lt;br&gt;
Currently, my Windows scripting is orchestrated by a simple hand-coded application whose sole job is to call a different Windows batch file at 10 minutes past every hour (GET00.BAT, GET01.BAT .... GET23.BAT).  Each batch file calls wget to download whatever data is needed.  It works splendidly.&lt;br&gt;
&lt;br&gt;
However it&apos;s not enough just to call the batch file... my app also has to form the pieces of the date/time and call them as arguments.  For example today 2/21/07 4:00pm would be called as:&lt;br&gt;
  GET00.BAT 2007 02 21 16 00&lt;br&gt;
(note that some are zero-padded).  These date/time values are needed to construct target filenames and are used in some source URLs.  For example, the command &lt;b&gt;WGET blah.com/junk.dat -O %1-%2-%3&lt;/b&gt; would put my data into &lt;b&gt;2007-02-21.dat&lt;/b&gt;.&lt;br&gt;
&lt;br&gt;
So my questions are essentially:&lt;br&gt;
&lt;br&gt;
1) Is cron appropriate for this kind of work?&lt;br&gt;
2) How can I set up a cron job where it runs all the time (i.e. when the computer is always on)?  I&apos;m not clear on how daemons are set up in a Linux desktop environment.&lt;br&gt;
3) Can scripting devise these required time parameters explained above, or can cron pass them?  Or is an ugly C++ program needed?&lt;br&gt;
4) A real newbie question: Does my choice of a shell (ksh, csh, etc) matter much here?&lt;br&gt;
&lt;br&gt;
Fortunately the data is not critical, so it&apos;s no biggie if I make some mistakes getting this set up.  I&apos;m just hoping for a push in the right direction.  Thanks.</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2007:site.57432</guid>
	<pubDate>Wed, 21 Feb 2007 14:57:54 -0800</pubDate>
	<category>cron</category>
	<category>linux</category>
	<category>script</category>
	<category>scripting</category>
	<dc:creator>zek</dc:creator>
	</item>
	<item>
	<title>How can I preserve Unicode characters in `mysqdump`?</title>
	<link>http://ask.metafilter.com/45417/How%2Dcan%2DI%2Dpreserve%2DUnicode%2Dcharacters%2Din%2Dmysqdump</link>	
	<description>How can I make backups of a MySQL database (via &lt;code&gt;mysqldump&lt;/code&gt;) and preserve Unicode characters (such as em dashes)? I use &lt;code&gt;mysqldump&lt;/code&gt; and &lt;code&gt;rsync&lt;/code&gt; to make backups of my &lt;a href=&quot;http://textdrive.com/&quot; title=&quot;Welcome to TextDrive - Reliable, high performance web hosting you can trust&quot;&gt;TextDrive&lt;/a&gt; account. One of the forums I run, however, often includes unencoded Unicode entities, such as em dashes and bullets.&lt;br&gt;
&lt;br&gt;
Because these characters aren&apos;t straight ASCII, restoring from previous &lt;code&gt;mysqldump&lt;/code&gt; backups has mangled them, producing gibberish but preserving the other, straight ASCII text in the database.&lt;br&gt;
&lt;br&gt;
My current &lt;code&gt;mysqldump&lt;/code&gt; call looks like this: &lt;code&gt;/usr/local/bin/mysqldump -uuser -ppassword --quote-names --complete-insert --extended-insert --quick --lock-tables=false --skip-add-locks --all-databases | gzip &amp;gt; db.sql&lt;/code&gt;. What&apos;s necessary to preserve these Unicode characters?&lt;br&gt;
&lt;br&gt;
Thanks.</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2006:site.45417</guid>
	<pubDate>Mon, 28 Aug 2006 11:55:32 -0800</pubDate>
	<category>backup</category>
	<category>charset</category>
	<category>cron</category>
	<category>database</category>
	<category>mysql</category>
	<category>mysqldump</category>
	<category>unicode</category>
	<dc:creator>cmyers</dc:creator>
	</item>
	
	</channel>
</rss>

