<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ridwan Hady on Medium]]></title>
        <description><![CDATA[Stories by Ridwan Hady on Medium]]></description>
        <link>https://medium.com/@rid1hady?source=rss-3fd26e8f8695------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*c27rptCUhVnjnyE19JuHqA.png</url>
            <title>Stories by Ridwan Hady on Medium</title>
            <link>https://medium.com/@rid1hady?source=rss-3fd26e8f8695------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 15:27:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rid1hady/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introduction to Program Automation: The Double-Edged Sword! ️]]></title>
            <link>https://medium.com/hmif-itb/introduction-to-program-automation-the-double-edged-sword-%EF%B8%8F-933aef83d166?source=rss-3fd26e8f8695------2</link>
            <guid isPermaLink="false">https://medium.com/p/933aef83d166</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cron]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[intern]]></category>
            <category><![CDATA[bukalapak]]></category>
            <dc:creator><![CDATA[Ridwan Hady]]></dc:creator>
            <pubDate>Wed, 31 Jul 2019 03:10:32 GMT</pubDate>
            <atom:updated>2019-08-04T13:25:35.780Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*8ymhCAxeoGOImjnu.jpg" /><figcaption><a href="https://image.freepik.com/free-vector/program-analyzing-ai-robot-artificial-intelligence-automated-process-data-reporting_39422-769.jpg">Source</a></figcaption></figure><h4>The Problem</h4><p>Let’s start this topic with the problem that I was facing. In the last few weeks, I joined Bukalapak as an engineer intern and was working on the Mitra Bukalapak apps, which was one of Bukalapak products that focuses on improving <em>‘w</em><a href="https://en.wikipedia.org/wiki/Warung"><em>arung kelontong</em></a><em>’ </em>values. When I joined the squad, Serbu Seru at the Mitra<strong> </strong>Bukalapak app didn’t generate its winner automatically, unlike its counterpart in the Bukalapak application. It still needed an administrator to smash the <strong>‘Generate Winner’</strong> button every time the event ended, even though the winner itself was chosen purely random by the program. So, here’s the problem:</p><blockquote>How to automate generate winner process on Serbu Seru event?.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*1CreCxgv2Gay1cgSDQUKFQ.jpeg" /><figcaption>Well, that’s my problem, being <strong><em>jomblo</em> (single -red) </strong>for years</figcaption></figure><h4>The Approach</h4><p>Well of course,<strong> Automate it! </strong>And to do it, let me introduce you to our savior, give your best hello to the….. *<em>drum roll plz</em>*…. <strong>“Cron Job!”</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FPfHrNe1cSKAjC%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fsmile-hello-shark-PfHrNe1cSKAjC&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FPfHrNe1cSKAjC%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="243" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1aefb60ab79fa6bcc8f6e57c7119275/href">https://medium.com/media/c1aefb60ab79fa6bcc8f6e57c7119275/href</a></iframe><p>YES, 💯 for you. Cron Job will be our main topic for this article. Let’s start with popping the biggest question.</p><p><strong>W̸i̸l̸l̸ ̸y̸o̸u̸ ̸m̸a̸r̸r̸y̸ ̸m̸e̸?̸</strong></p><h4>What is a Cron Job?</h4><p>According to <a href="https://en.wikipedia.org/wiki/Maize">Wikipedia</a>, Cron is a cereal grain first domesticated by indigenous peoples in southern Mexico about 10,000 years ago. The leafy stalk of the plant produces pollen inflorescence and separate ovuliferous inflorescence called ears that yield kernels or seeds, which are fruits. 🌽🌽🌽</p><p>Whoops, wrong reference. Back to our main topic. In short:</p><blockquote>A Cron automatically runs tasks for you at very specific times.</blockquote><p>Based on an article called “Newbie: Intro to Cron” published by <a href="http://www.unixgeeks.org/security/newbie/unix/cron-1.html">Unixgeeks.org</a>, Cron is the name of program that enables unix users to execute commands or scripts (groups of commands) automatically at a specified time/date. A common use for it today would be connecting to the internet and downloading your email. The name cron itself comes from the Greek word for time, <em>χρόνος</em> (<a href="https://en.wikipedia.org/wiki/Chronos"><em>chronos</em></a>).</p><h4>How to write Cron’s Script?</h4><p>The script varies depending on the programming language or technology being used, but the greatest similarity is in the scheduling format. It’s called <strong><em>Crontab</em></strong>, which stands for <strong><em>Cron Table.</em></strong></p><p>Crontab is a configuration file that specifies shell command to run periodically on a given schedule. The file location varies by operating systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*-3Gz3nRJVbxo5kSRRnNwBg.png" /><figcaption>Crontab File Location Table</figcaption></figure><h4><strong>What about its syntax?</strong></h4><p>Crontab’s syntax follow this rule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*Dg_mVRSwZfcN5sAyiKNXtA.png" /><figcaption>Crontab format</figcaption></figure><p>The syntax of each line expects a cron expression made of five fields. As seen above, the first line represents minute, second line represents hour, and so on. For example, if you want to run a task that runs daily at midnight, you need to write 0 0 * * * mytask.py.</p><p>If you’re not sure with your scheduling, you can always check it on some online websites, like this one:</p><p><a href="https://crontab.guru/">Crontab.guru - The cron schedule expression generator</a></p><p>If you want to dig more about Cron Expression, you can read here:</p><p><a href="https://help.ubuntu.com/community/CronHowto">CronHowto</a></p><p>If you want to try writing one, you can start with one of these tutorials:</p><ul><li><a href="https://scotch.io/tutorials/nodejs-cron-jobs-by-examples">Node.js Cron Jobs By Examples</a></li><li><a href="https://launchschool.com/blog/cron-jobs-and-rails">Cron Jobs and Rails</a></li><li><a href="https://stackabuse.com/scheduling-jobs-with-python-crontab/">Scheduling Jobs with python-crontab</a></li></ul><h4>Is there any good reason why I should use this?</h4><p>There are a lot of reasons to automate your task. But on a side note: not all tasks can be automated.</p><ol><li><strong>Cut the work hours —</strong> If you do it right, cron jobs can slice thousands hours of work into an hour or even a minute.</li><li><strong>Run tasks at specific time —</strong> It’s hard for a human being to run something and always on time, but not machine right?</li><li><strong>Memory — </strong>When it’s not running, it’s not occupying memory in system.</li><li><strong><em>etc.</em></strong></li></ol><h4>How about why I shouldn’t?</h4><p>This is the reason why I called this as a double-edged sword. Beside its advantages, there are many disadvantages as well. Here’s a few cons with cron:</p><ol><li><strong>Error handling — </strong>If a job fails, what should happen? Cron can’t alert you if your job fail or has <strong>never</strong> started.</li><li><strong>Logging — </strong>Cron doesn’t log, unless the developer made them to.</li><li><strong>Cron runs on system level — </strong>Cron is a system level process, not an application process. A good problem example is timezone: if a person changes the timezone of a server, the cron may run at different time than expected.</li></ol><p>Not enough? You can read more at this thread:</p><p><a href="https://askubuntu.com/questions/23009/why-crontab-scripts-are-not-working?source=post_page---------------------------">Why crontab scripts are not working?</a></p><h4>Conclusion</h4><p>Using cron can give you many benefits as long as you do it right. There are lots of tools that you can use to prevent any of those cons. Not every task that you have needs to be automated, so do it wisely. Let me close this post with a quote.</p><blockquote>“Automation is good, so long as you know exactly where to put the machine. “ — Eliyahu Goldratt</blockquote><h4>Note:</h4><p>Every suggestion or critic of this article is very much welcomed and appreciated, just leave one of those in the comment section or send it to my email: ridwanhady31@gmail.com. Thanks!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FVObHs6oqEWFNe%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FVObHs6oqEWFNe%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FVObHs6oqEWFNe%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="261" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c48092a6041528d3ac16f965817f9ad/href">https://medium.com/media/4c48092a6041528d3ac16f965817f9ad/href</a></iframe><h4>References:</h4><ul><li><a href="http://www.unixgeeks.org/security/newbie/unix/cron-1.html">Newbie: Intro to cron</a></li><li><a href="https://www.adminschoice.com/crontab-quick-reference">Crontab - Quick Reference</a></li><li><a href="https://medium.com/eshares-blog/why-you-shouldnt-use-cron-jobs-5d76001e18d5">Why you shouldn’t use “Cron Jobs”</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=933aef83d166" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hmif-itb/introduction-to-program-automation-the-double-edged-sword-%EF%B8%8F-933aef83d166">Introduction to Program Automation: The Double-Edged Sword! 🗡️</a> was originally published in <a href="https://medium.com/hmif-itb">HMIF ITB Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>