How to: Edit Crontab on QNAP and keep the changes after a reboot

Problem / Outcome Summary

  • This article will show you how to make changes to crontab on a QNAP NAS and have them kept after a reboot
  • Please see the ‘Summary Overview’ tab below for a high level view of the objectives this ‘howto’ will achieve.

Why might I want to do this?

  • If you want to add a scheduled task to your QNAP NAS, you would undoubtedly want to know that it saves permanently
  • The normal method for saving your crontab does not work on a QNAP NAS after it is rebooted

To be clear, what does Crontab do?

Simply put, crontab is a process that runs on *nix based systems (that’s Unix, Linux, BSD etc) and schedules programs to run on preset schedules.  Common types of things ‘triggered’ by the crontab process are backups, email server tasks, log rotations and database maintenance.

How does Crontab work?

Crontab works by processing a list in a textfile (the crontab file), in order and processing it as per your configuration.  In that configuration, you point it at other programs or files and say to them to run at your configured schedule.

An example of a line in crontab is shown below:

30     20     *     *     *         rm /home/someuser/tmp/*

There are plenty of detailed examples on how crontab works on the internet such as this at which will explain the format of the above crontab line.

So how do I make the changes stick after a reboot?

This is really, really simple.

  1. Edit your crontab file eg: vi /etc/config/crontab
  2. Make crontab see the changes: crontab /etc/config/crontab
  3. Restart the crontab service: /etc/init.d/ restart

All done!


[td_block_21 modules_on_row="" modules_gap="" image_width="28" image_floated="float_left" meta_padding="0" image_radius="8" image_height="70" meta_info_horiz="" modules_category="" modules_category_margin="-1px 10px 0 0" show_excerpt="none" show_btn="none" show_com="none" show_author="none" show_cat="" image_size="td_324x400" block_template_id="" f_title_font_line_height="eyJhbGwiOiIxLjIiLCJwb3J0cmFpdCI6IjEuMSIsImxhbmRzY2FwZSI6IjEuMSIsInBob25lIjoiMS4xIn0=" f_title_font_family="406" f_title_font_size="eyJhbGwiOiIxOCIsImxhbmRzY2FwZSI6IjE2IiwicG9ydHJhaXQiOiIxNCIsInBob25lIjoiMTYifQ==" f_title_font_weight="eyJhbGwiOiI4MDAiLCJwb3J0cmFpdCI6IjYwMCJ9" f_cat_font_size="eyJhbGwiOiIxMSIsImxhbmRzY2FwZSI6IjEwIiwicG9ydHJhaXQiOiI5IiwicGhvbmUiOiIxMCJ9" f_cat_font_weight="800" f_cat_font_family="406" f_cat_font_transform="uppercase" f_meta_font_size="eyJhbGwiOiIxMSIsImxhbmRzY2FwZSI6IjEwIiwicG9ydHJhaXQiOiI5IiwicGhvbmUiOiIxMCJ9" f_meta_font_transform="uppercase" f_meta_font_family="406" all_modules_space="eyJhbGwiOiI0MiIsImxhbmRzY2FwZSI6IjM0IiwicG9ydHJhaXQiOiIyNCIsInBob25lIjoiMzIifQ==" meta_info_align="center" art_title="eyJhbGwiOiIwIDAgMTJweCIsImxhbmRzY2FwZSI6IjAgMCA4cHgiLCJwb3J0cmFpdCI6IjAgMCA2cHgiLCJwaG9uZSI6IjAgMCA4cHgifQ==" modules_category_padding="3px 0 4px" cat_txt="#0d42a2" cat_bg="rgba(13,66,162,0)" f_meta_font_weight="800" tdc_css="eyJhbGwiOnsibWFyZ2luLXRvcCI6IjIwIiwibWFyZ2luLWJvdHRvbSI6IjAiLCJkaXNwbGF5IjoiIn0sInBob25lIjp7ImRpc3BsYXkiOiIifSwicGhvbmVfbWF4X3dpZHRoIjo3Njd9" hide_image="yes" modules_divider="solid" title_txt="#000000" related_articles_posts_limit="5" sort="popular" custom_title="Popular Articles"]

Related Stories


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay on op - Ge the daily news in your inbox