Cron doesn't work

I want to schedule a shutdown at 22:05 on thursday and 19:05 the rest of the week

i tried, without success, this:

~ >>> crontab -e
05 19 * * 0,1,2,3,5,6 /usr/bin/shutdown -h now
05 22 * * 4 /usr/bin/shutdown -h now

~ >>> sudo crontab -e
05 19 * * 0,1,2,3,5,6 /usr/bin/shutdown -h now
05 22 * * 4 /usr/bin/shutdown -h now

Probably the problem is that cron isn’t active, but no idea how to do it.

~ >>> systemctl status cronie                                                                                                                                                                                    [3]
● cronie.service - Periodic Command Scheduler
     Loaded: loaded (/usr/lib/systemd/system/cronie.service; disabled; vendor preset: disabled)
     Active: inactive (dead)
Generated on 2020-11-04 13:58:1604509139

#################### inxi -Fxzc0 ########################

System:    Kernel: 5.8.16-2-MANJARO x86_64 bits: 64 compiler: N/A Desktop: GNOME 3.36.6 
           Distro: Manjaro Linux 
Machine:   Type: Desktop System: Gigabyte product: N/A v: N/A serial: <filter> 
           Mobo: Gigabyte model: H61M-S1 v: x.x serial: <filter> BIOS: American Megatrends v: FC 
           date: 02/25/2013 
CPU:       Topology: Quad Core model: Intel Core i5-3340 bits: 64 type: MCP arch: Ivy Bridge 
           rev: 9 L2 cache: 6144 KiB 
           flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 24757 
           Speed: 1597 MHz min/max: 1600/3300 MHz Core speeds (MHz): 1: 1597 2: 1597 3: 1597 
           4: 1597 
Graphics:  Device-1: Intel Xeon E3-1200 v2/3rd Gen Core processor Graphics vendor: Gigabyte 
           driver: i915 v: kernel bus ID: 00:02.0 
           Display: wayland server: 1.20.9 compositor: gnome-shell driver: i915 
           note: display driver n/a - try sudo/root resolution: <xdpyinfo missing> 
           OpenGL: renderer: Mesa DRI Intel HD Graphics 2500 (IVB GT1) v: 4.2 Mesa 20.1.8 
           direct render: Yes 
Audio:     Device-1: Intel 6 Series/C200 Series Family High Definition Audio vendor: Gigabyte 
           driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
           Sound Server: ALSA v: k5.8.16-2-MANJARO 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Gigabyte 
           driver: r8169 v: kernel port: e000 bus ID: 02:00.0 
           IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 931.51 GiB used: 41.60 GiB (4.5%) 
           ID-1: /dev/sda vendor: Toshiba model: DT01ACA100 size: 931.51 GiB 
Partition: ID-1: / size: 907.80 GiB used: 41.60 GiB (4.6%) fs: ext4 dev: /dev/sda1 
Swap:      ID-1: swap-1 type: partition size: 8.22 GiB used: 0 KiB (0.0%) dev: /dev/sda2 
Sensors:   System Temperatures: cpu: 45.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 191 Uptime: 2h 14m Memory: 3.73 GiB used: 1.82 GiB (48.7%) Init: systemd 
           Compilers: gcc: N/A Packages: 1099 Client: shell wrapper v: 5.0.18-release inxi: 3.1.05

Enable cronie.service with

systemctl enable --now cronie.service


Also the shutdown command might require higher privileges. If it doesn’t work in your user crontab, add it to the system crontab (executed as root user), or at the personal crontab of the root user.

1 Like

It worked, thanks!

1 Like

For the record this is what i exactly did

~ >>> systemctl enable --now cronie.service
~ >>> crontab -e
05 19 * * 0,1,2,3,5,6 shutdown -h now
05 22 * * 4 shutdown -h now


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.