what is the difference between cron and systemd ? Why we can't use use only one of this two?

  • 1
    What do you mean? The two have very little in common, of course you can use both cron and systemd. It's just that systemd also offers cron-like functionality, that doesn't mean that they are incompatible. – terdon Jun 4 '15 at 11:23
  • And what makes you think that we cannot use only one of the two? I have many systems that use only one of the two. I even have systems that use neither of the two. This question takes a falsehood as its premise; or is badly written and does not in fact say what you wanted to ask. – JdeBP Jun 4 '15 at 12:03

They are completely different things. systemd is an init system (replaces the old systemV init). It extends it in the following ways:

  • It unifies the init, login and initscripts, so that different distributions no longer have each its own custom set of scripts to load daemons
  • It tracks the services (daemons) so that it has control over them after they start, it can also hold on to the sockets for communitation and start them on demand
  • init was ok on the older, more static setups, but with hotplugging, volatile connections, multiseat invariants, systemd is a bit more robust.
  • It parallelizes the boot sequence by figuring out the dependencies and starting indepenent things in parallel.
  • It knows and controls a lot about your system - init just started the specified scripts and login interface and then did almost nothing until the shutdown. This is one of the things that makes people sceptical - it feels bloated and harder to customize or debug. Anyway - it monitors the processes, tracks changes in the hardware, controls time, locale and power management, mounting of storage and timers. In this respect, you don't strictly need cron if you are using systemd. However, it doesn't work the other way around!

So... if you use init, then you need cron or something similar to schedule periodic tasks. If you use systemd, you can still use cron, but you can also rewrite the rules as .timer files and let systemd worry when to start things (instead of relying on a separate daemon).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.