1

I have a few Raspbian cron entries that runs @reboot. Some are network dependent (i.e. ntp-wait).

My question is, with Raspbian Jessie, if "wait for network" is enabled in raspi-config, will cron run these entries before the network is up or will the entire system halt until the network is up? In other words, where in the boot-up sequence is crontab activated?

5

will the entire system halt until the network is up

No.

where in the boot-up sequence is crontab activated?

Crontabs are managed by cron, a system daemon started by init, which on Raspbian jessie is systemd.

Exactly when a service is started in terms of time depends on what it depends on, and a degree of indeterminacy, since things that do not depend on one another may be started in parallel. You can get a fancy graph of everything from the last boot with systemd-analyze plot > sysd.svg --- unfortunately, the plain jane text output of systemd-analyze critical-chain won't include cron.service because it isn't part of the "critical chain". However, .svg files are viewable in a web browser (and you should be able to text search them there as well). Here's an example from a headless Pi running Jessie, with cron enabled -- you'll have to "open image in a new tab" to make this legible, and S.E. does not allow .svg uploads, so I converted it to a .png, which are not text searchable.

enter image description here

You can find cron down near the bottom, starting at around the 18s mark (this is on a B+). My networking is done in an oddball manner, but I think on a more stock system this will probably be after an ethernet connection is already established, or within a few seconds of wifi (which can take a more variable amount of time).

You can get a dependency tree, which is simpler and more abstract, with systemctl list-dependencies --after cron. It might look like this, with the dots either red or green to indicate the state of the service:

cron.service
● ├─system.slice
● ├─systemd-journald.socket
● └─basic.target
●   ├─systemd-ask-password-plymouth.path
●   ├─paths.target
●   │ ├─systemd-ask-password-console.path
●   │ └─systemd-ask-password-wall.path
●   ├─slices.target
●   │ ├─-.slice
●   │ ├─system.slice
●   │ └─user.slice
●   ├─sockets.target
●   │ ├─avahi-daemon.socket
●   │ ├─dbus.socket
●   │ ├─syslog.socket
●   │ ├─systemd-initctl.socket
●   │ ├─systemd-journald-dev-log.socket
●   │ ├─systemd-journald.socket
●   │ ├─systemd-shutdownd.socket
●   │ ├─systemd-udevd-control.socket
●   │ └─systemd-udevd-kernel.socket
●   ├─sysinit.target
●   │ ├─console-setup.service
●   │ ├─debian-fixup.service
●   │ ├─dev-hugepages.mount
●   │ ├─dev-mqueue.mount
●   │ ├─emergency.service
●   │ ├─fake-hwclock.service
●   │ ├─hdparm.service
●   │ ├─kbd.service
●   │ ├─keyboard-setup.service
●   │ ├─kmod-static-nodes.service
●   │ ├─networking.service
●   │ ├─plymouth-read-write.service
●   │ ├─proc-sys-fs-binfmt_misc.automount
●   │ ├─raspi-config.service
●   │ ├─sys-fs-fuse-connections.mount
●   │ ├─sys-kernel-config.mount
●   │ ├─sys-kernel-debug.mount
●   │ ├─systemd-binfmt.service
●   │ ├─systemd-journald.service
●   │ ├─systemd-modules-load.service
●   │ ├─systemd-random-seed.service
●   │ ├─systemd-readahead-collect.service
●   │ ├─systemd-readahead-replay.service
●   │ ├─systemd-sysctl.service
●   │ ├─systemd-tmpfiles-setup-dev.service
●   │ ├─systemd-tmpfiles-setup.service
●   │ ├─systemd-udev-settle.service
●   │ ├─systemd-udev-trigger.service
●   │ ├─systemd-udevd.service
●   │ ├─systemd-update-utmp.service
●   │ ├─cryptsetup.target
●   │ ├─emergency.target
●   │ │ └─emergency.service
●   │ ├─local-fs.target
●   │ │ ├─-.mount
●   │ │ ├─boot-BOOT.mount
●   │ │ ├─boot.mount
●   │ │ ├─mnt-hd.mount
●   │ │ ├─mnt-hd2-raspberry_pi-boot.mount
●   │ │ ├─mnt-hd2-raspberry_pi-root.mount
●   │ │ ├─mnt-hd2.mount
●   │ │ ├─systemd-fsck-root.service
●   │ │ ├─systemd-remount-fs.service
●   │ │ └─local-fs-pre.target
●   │ │   ├─systemd-remount-fs.service
●   │ │   └─systemd-tmpfiles-setup-dev.service
●   │ └─swap.target
●   └─timers.target
●     └─systemd-tmpfiles-clean.timer

The --after means this is stuff that cron depends on (and the stuff that stuff depends on), i.e., it is stuff cron starts after.

  • Good answer, thanks. Out of curiosity, at what process is the network activated (or halted for)? – Renier Delport Jan 6 '17 at 14:11
  • 1
    In general "networking" would be the root of it; you may also want to check and see if NetworkManager is in play on your system (it isn't above, and note these aren't direct dependencies for cron) -- systemctl list-units | grep -i network will show you a list of likely candidates. When something like that starts is not necessarily indicative of when an actual connection to an external network has been established, but again, with ethernet I think within a few seconds, with wifi it may be 5-10. – goldilocks Jan 6 '17 at 14:21

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.