- fcron extends the capabilities of cron by allowing pending tasks to run on computers that are not powered on 24/7 and offers a more flexible scheduling syntax.
- The configuration and security of fcron and cron is based on files such as /etc/fcron.conf, /etc/fcron.allow, /etc/fcron.deny, /etc/crontab and the cron.* directories, along with integration with syslog.
- The correct use of fcrontab and crontab, along with good environment management (PATH, permissions, logs), is key to automating tasks reliably and without surprises.
- Careful design of scheduled tasks, avoiding overlaps and controlling resource consumption, allows you to take advantage of automation without degrading system performance.

If you work in systems administration Linux Whether you have a home server that's always on or you're wondering how to... Automate maintenance tasks, backups, and scripts without having to keep an eye on the clock. That's where fcron comes in: a task scheduler that goes a step beyond cron and is much better suited to computers that aren't powered on 24/7.
Throughout this article you will see, in considerable detail, how schedule tasks with fcronThis guide will cover what differentiates this daemon from cron and anacron, how it integrates with syslog, which configuration files are involved, how to use fcrontab to define jobs, and what typical problems you might encounter when automating processes in GNU/Linux. The goal is for you to gain a comprehensive understanding of both fcron and the classic cron ecosystem, so you can choose and configure the solution that best suits your needs.
What is fcron and how does it differ from cron and anacron?
fcron is a task scheduling daemon designed for systems that don't necessarily stay on all the time ThereIt fills the gap between cron (which assumes the machine is always active) and anacron (focused on daily, weekly, monthly tasks without dependence on the exact time).
While cron checks every minute whether it should run something based on the system time, as explained in Schedule tasks in Linux using cron and at, fcron is capable of executing "pending" jobs that couldn't be launched because the computer was off. Therefore, if you schedule a task to run every day at 03:00 AM and the computer turns on at 09:00 AM, fcron can decide to run that job as soon as... Boot, depending on the configuration you have given it.
Another important difference is that fcron allows much more flexible planning expressionsIt offers options such as "every X amount of uptime," concurrency limits, priorities, and richer conditions than those offered by classic cron. Furthermore, it integrates with syslog using the ease of cronTherefore, all of its activity logs are centralized in the system logs.
Like other programs of this type, fcron consists of a main daemon (fcron) and a utility for managing task tables, called fcrontab, which is the direct equivalent of the old crontab command but with added syntax and options.
Configuration and access control files in fcron
When you install fcron, several key files appear in the system that you should be familiar with. The most important ones are: /etc/fcron.conf, /etc/fcron.allow y /etc/fcron.deny, who control the overall behavior of the daemon and who can schedule tasks.
The file /etc/fcron.conf defines the global configuration of the fcron daemon: environment options, paths, default behavior, and parameters that affect how jobs are managed. Although in most basic installations It is not necessary to touch this fileIt is recommended to read its manual page (man fcron.conf) to learn about all the possibilities, especially if you are going to take advantage of the advanced features.
For user access control, fcron uses the files /etc/fcron.allow y /etc/fcron.denyIn a manner very similar to cron. In fcron.allow you can explicitly list the users you want to allow to use fcrontab, while in fcron.deny you can specify a "blacklist" of users who are blocked from access. If fcron.allow exists, it takes precedence. and fcron.deny is ignored; if none exists, the default behavior is usually to allow the use of fcron to everyone or only to root, according to the distribution.
In addition to these files, the daemon integrates with the boot system through a script Initially, usually in /etc/rc.d/init.d/fcron or equivalent locations depending on the distro. This script usually arrives on your system through packages such as blfs-bootscripts, which provide the necessary scripts to activate services at startup.
System installation and preparation for using fcron
Before you start scheduling tasks, you need to have the service correctly installed and well integrated with the log logging and user system. This is where configuration comes into play. syslog, the creation of a dedicated user and the fcron compilation/installation process itself if you are coming from source code.
By default, fcron uses the facility syslog cron to write all your messages. In systems where the file /etc/syslog.conf Since no entry is defined for that facility (common in environments like LFS or BLFS), it's necessary to add a line to save messages in a separate log. A typical way to do this is to append:
cron.* -/var/log/cron.log
With this, all messages tagged as cron (including those from fcron) will be stored in /var/log/cron.logAfter modifying syslog.conf, it is essential reload the logging daemon (for example, sysklogd) to make the new configuration take effect, using a command like:
/etc/rc.d/init.d/sysklogd reload
From a security standpoint, it's good practice to run fcron under a user and group without privilegesThe usual practice is to create a specific system account, for example:
Create user and service group: groupadd fcron && useradd -c fcron -g fcron fcron
Once the logging environment and service user are set up, you can proceed to compile and install fcron from source if your distribution does not offer a suitable pre-compiled package. A fairly common workflow involves running:
Compile and install from source: ./configure --without-sendmail --with-answer-all=no && make && make install
The option –without-sendmail It indicates that fcron will not use an MTA (Mail Transfer Agent) to send emails with job completions, although it is perfectly capable of integrating with one if you have it installed. If you are interested in receiving email notifications, you can use something like --with-sendmail=/ruta/a/tu/MTA in the configure, pointing to the actual binary of your mail server.
Parameter –with-answer-all=no controls the behavior of the configuration routine that runs during make installPart of that process usually asks if you want to install a boot script under /etc/rc.d/init.d and automatically create symbolic links at runlevels 2, 3, 4, and 5, as well as stop any existing fcron instances and start a new one. If this is your first installation and you prefer to use a startup script that follows your system's standard template (for example, BLFS scripts), it's normal to answer "n" to these questions, as suggested in the documentation.
It tienes OpenJade and DSSSL stylesheets Once installed, you can add an additional option to configure, such as --with-dsssl-dir=/usr/share/sgml/docbook/dsssl-stylesheets-1.78This will generate documentation from the sources in DocBook. It's not required to run fcron, but it can be useful if you want to have the documentation in additional formats.
Using fcrontab to schedule tasks with fcron
The main tool for defining and modifying fcron tasks is fcrontabIt works similarly to a traditional crontab, but with specific extensions and fcron's own syntax. Each user can have their own job table, and there is also a system fcrontab which is usually in /etc/fcrontab.
When you modify the system task file, it is necessary reload it explicitly so that fcron can read the changes. In the case of the global fcrontab, after editing /etc/fcrontab You will need to run something like:
Reload fcrontab: fcrontab /etc/fcrontab
This loads the contents of that file into the internal table managed by the daemon. The fcrontab man page details all the options, but the basic usage pattern is similar to that of cron. For a user's own fcrontab (including root), simply run:
fcrontab -e
As with crontab, your default text editor (vi, nano, etc.) will open, allowing you to add or modify lines that define your jobs. Each entry describes when and how a command or script will be executed, and fcron handles running it. even if there is no active login sessionIn other words, the presence or absence of interactive users in the system is irrelevant: fcron jobs run in the background regardless.
In addition to fcrontab, fcron provides the utility fcronsighupwhose function is to send a signal to the demon so that reread the task tables without needing to restart the service. This is especially useful after frequent configuration changes or if you manage fcron on systems with many scheduled tasks.
Scheduling tasks with cron and crontab: fundamentals and syntax
Although fcron offers many advantages, understanding how it works remains crucial. classic cron and its crontab filebecause many of the concepts are shared and many distributions have it enabled by default as soon as the system is installed.
Cron It's a daemon that runs in the background from the operating system's startup. Every minute it checks if the scheduling files (such as /etc/crontab or user crontabs in /var/spool/cron/crontabsThere is a task whose execution time coincides with the current system time. Hence the importance of having it properly configured the time and time zone.
To verify the time setting on current systems, it is common to use timedatectlThis displays the local time, universal time, time zone, and whether the clock is synchronized with NTP servers. If you find that the time zone is incorrect, you can adjust it with a command like this:
Adjust time zone: timedatectl set-timezone Europe/Madrid
Regarding the crontab format, each line that defines a task follows the classic structure of five time fields plus the command. Each asterisk or value indicates a specific part of the date:
- Minute: from 0 to 59.
- Time: from 0 to 23.
- Day of the month: from 1 to 31.
- Month: from 1 to 12.
- Weekday: from 0 to 6, where 0 (and sometimes 7) represents Sunday.
- Command: the command or script you want to run.
Daily example: 00 19 * * * usuario /ruta/al/script/consulta.sh
Example Sunday: 00 19 * * 0 usuario /ruta/al/script/consulta.sh
Annual example: 00 19 4 2 * usuario /ruta/al/script/consulta.sh
The syntax also allows special characters which allow very powerful rules: the asterisk for "any value", the comma for lists, the hyphen for ranges (for example 1-5, Monday to Friday), the slash to indicate periodicities (*/10 for "every 10 units") and combinations like "range/exception" to exclude certain specific values.
System crontab and cron directories.* in Linux
In many distributions, especially in environments like Debian, cron is organized around a system crontab in /etc/crontab already several special directories under /etc/ where scripts can be left to run at different predefined intervals.
The file / etc / crontab It usually includes inputs that trigger the command run-parts pointing to directories like /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly y /etc/cron.monthlyThe idea is that any script you place there (and that meets certain permission and name conditions) will automatically run at the specified interval, without you having to manually type all the lines.
Typical example of /etc/crontab: 17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
These lines cause all scripts present in the indicated directories to be executed every hour, every day, every week, and every month, using the tool run-parts, which is responsible for calling in a chain all the executable files that meet a certain name pattern.
For cron to execute these scripts without problems, several conditions must be met: to have execute permission, to belong to rootThe group and others must not have write permission, and the name must only contain letters, digits, underscores, or hyphens. If the name contains other characters, cron will simply ignore it.
In addition, there is the directory /etc/cron.dThis is intended for system applications to place their own crontab files there, containing specific rules that don't fit in the four directories mentioned above. Debian recommends that the main administrator put their global rules in /etc/crontab and leave /etc/cron.d for packages and services installed later.
Access control to cron: cron.allow and cron.deny
Like fcron, classic cron allows you to restrict which users can create scheduled jobs using two very simple files: /etc/cron.allow y /etc/cron.denyThe first acts as a whitelist and the second as a blacklist.
If you create /etc/cron.allow and add one or more usernames, Only those users will have the right to use crontab and define their own tasks, with the rest being automatically blocked. If you prefer the opposite, that is, to allow everyone except a few, you can keep /etc/cron.allow empty or nonexistent and use /etc/cron.deny to list only the blocked users.
Default behavior: In some systems, if none of these files exist, any user is allowed access to cron; in others, however, only root has that privilege by default. It's a good idea to check your distribution's documentation to avoid surprises.
This same pattern is replicated with fcron through /etc/fcron.allow y /etc/fcron.denyThis allows you to unify your security policy for both daemons and decide precisely who can program what.
Logs and debugging of scheduled tasks
Cron and fcron generate messages that are vital for diagnose problems, check executions, and detect errorsIn many systems, cron-related events are dumped into /var/log/syslog or in a specific file such as /var/log/cron.log, depending on how syslog or rsyslog is configured.
In the specific case of Debian cron, it is also possible to adjust what type of events are logged using extra options in /etc/default/cronThere you can add a line like this:
EXTRA_OPTS='-L 5'
The -L parameter accepts a numeric value that is the sum of several flags: 1 to record the start of a task, 2 for the end, 4 for jobs that end with a non-zero error code, and 8 to record the PID of each launched process. A value of 5, for example, combines 1 and 4so that only the start of jobs and those that fail are recorded, reducing noise in the logs.
Fcron, by using the cron facility within syslog, benefits from the same configuration: once you've defined in /etc/syslog.conf that cron.* should target a specific log, everything fcron does will also be recorded there, which is very convenient when you're fine-tuning a programming complicated.
Impact on performance and best practices when scheduling tasks
Automating processes is wonderful, but careless use of cron or fcron can have very negative effects on system performanceIt's easy to fall into the temptation of firing very heavy scripts too frequently, resulting in CPU spikes, heavy disk accesses, or network saturation.
Example load: When you concentrate several demanding tasks in the same time slot, you can cause them all to launch simultaneously, putting a strain on your system. For example, performing large backups, rotating logs from many services, and updating large systems. databases Right at midnight can be a bad idea if the server is also handling critical requests at that time.
To mitigate these problems, it is recommended Stagger tasks and take advantage of off-peak hours, such as the early morning. You can also introduce randomness or conditions into the scripts, so that they only run if the system is sufficiently idle (low CPU, disk or network usage).
Priority and limits: Tools like nice o cpulimit They are very useful: you can run your scripts with low priority or limit the maximum percentage of CPU they consume. This way, even if they run at critical times, they will have less impact on other processes.
Avoid overlaps: In systems where a single job can overlap with itself, it is advisable to use utilities such as flock To prevent concurrent executions, a common pattern is to wrap the script in a file lock: if the lock is already taken, the new attempt by cron or fcron simply exits without doing anything, avoiding conflicts in simultaneous access to the same resources.
Common mistakes when using cron and fcron and how to avoid them
When starting to schedule tasks, it is common to encounter situations where The scripts either "do not run" or appear to run erratically.Often, the problem isn't in cron or fcron, but in environment details, permissions, or paths.
One of the most common mistakes is assuming that the cron or fcron runtime environment is the same as your interactive session's. In reality, these daemons launch the commands in an environment very minimalist, with a limited PATHIf your script calls binaries like git, python or any program installed in non-standard paths, and you don't specify the full path, it's likely to fail.
Use absolute paths: The solution involves using absolute paths within scripts (for example, /usr/bin/python instead of python) or explicitly define the PATH variable at the beginning of crontab or fcrontab, with something like:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Check permissions: Another source of problems is execution permissions. If the file is not executable or the user running the task does not have sufficient permissions on the involved directories and resources, the job will fail silently or only leave traces in the logs. Check with ls -l and correct with chmod +x When necessary, and consider whether your script really needs root privileges or if a normal user account is sufficient.
It is highly recommended that, during the tests, redirect stdout and stderr to files within your cron or fcron entries, so you can inspect what has happened. A construct like >/ruta/log.txt 2>&1 Adding a crontab line to the end can save you hours of frustration.
Finally, remember that handling time changes (summer/winter time) isn't always straightforward. Cron tries to manage jumps of less than three hours as best as possible, but if your tasks depend heavily on the order and time elapsed between executions, It may be prudent to avoid the conflict zone or design special rules for those nights of time change.
Mastering cron, fcron, and their subtle nuances allows you to build a very powerful automation layer on top of any Linux system, combining the simplicity of the expressions of time with the full potential of scripts and console tools to maintain, monitor and optimize your servers without having to be on top of them at all times.
Passionate writer about the world of bytes and technology in general. I love sharing my knowledge through writing, and that's what I'll do on this blog, show you all the most interesting things about gadgets, software, hardware, tech trends, and more. My goal is to help you navigate the digital world in a simple and entertaining way.