0

This is on Proxmox VE 7.3 with Debian 11. I ran crontab -e, added @reboot /home/onboot.sh to the file, saved it, ensured cron is running with systemctl enable cron.serviceand verified it's running at boot with systemctl status cron.service.

● cron.service - Regular background program processing daemon
     Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-02-08 17:16:52 EST; 11min ago
       Docs: man:cron(8)
   Main PID: 988 (cron)
      Tasks: 1 (limit: 9394)
     Memory: 1.1M
        CPU: 25ms
     CGroup: /system.slice/cron.service
             └─988 /usr/sbin/cron -f

Feb 08 17:16:52 svr systemd[1]: Started Regular background program processing daemon.
Feb 08 17:16:52 svr cron[988]: (CRON) INFO (pidfile fd = 3)
Feb 08 17:16:52 svr cron[988]: (CRON) INFO (Running @reboot jobs)
Feb 08 17:16:52 svr CRON[994]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 08 17:16:52 svr CRON[996]: (root) CMD (sleep 120 /home/onboot.sh)
Feb 08 17:16:52 svr CRON[994]: pam_unix(cron:session): session closed for user root
Feb 08 17:17:01 svr CRON[1063]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 08 17:17:01 svr CRON[1064]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 08 17:17:01 svr CRON[1063]: pam_unix(cron:session): session closed for user root

The onboot.sh file contains the following:

#!/bin/bash

# Remove USB module or interrupt handler conflict with NIC stops qm 100
rmmod ehci_pci
rmmod ehci_hcd

I've tried to move the script file to /home, /usr/local/bin and /usr/local/sbin, no luck. After 2 reboots, cron log shows:

Feb  8 17:08:13 svr cron[985]: (CRON) INFO (pidfile fd = 3)
Feb  8 17:08:13 svr cron[985]: (CRON) INFO (Running @reboot jobs)
Feb  8 17:08:13 svr CRON[993]: (root) CMD (sleep 120 /home/onboot.sh)
Feb  8 17:15:09 svr crontab[2206]: (root) BEGIN EDIT (root)
Feb  8 17:15:34 svr crontab[2206]: (root) END EDIT (root)
Feb  8 17:16:52 svr cron[988]: (CRON) INFO (pidfile fd = 3)
Feb  8 17:16:52 svr cron[988]: (CRON) INFO (Running @reboot jobs)
Feb  8 17:16:52 svr CRON[996]: (root) CMD (sleep 120 /home/onboot.sh)
Feb  8 17:17:01 svr CRON[1064]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

But that's it. If I run the script file normally as in bash /home/onboot.sh, it executes perfectly fine. Permissions for /home/onboot.sh are

-rwxr-xr-x 1 root root 150 Feb 8 17:14 /home/onboot.sh

What obvious oversight am I making?

13
  • so the command you're running is sleep 120 /home/onboot.sh? try that on the command line and see what happens Feb 8, 2023 at 22:36
  • 2
    I've never heard of a sleep n "cron job parameter" - do you have any documentation that describes these cron job parameters? Feb 8, 2023 at 22:51
  • 1
    Your PATH only contains /usr/bin:/bin, but rmmod is in /sbin. Use the full path /sbin/rmmod. Check your mail.
    – Freddy
    Feb 8, 2023 at 23:06
  • 2
    Rather than invoking rmmod why not blacklist the modules and have them not load in the first place? Feb 8, 2023 at 23:21
  • 1
    @JustinRiley if you have an initramfs you'd need to update that too Feb 9, 2023 at 8:14

1 Answer 1

0

All credit to Freddy but the fix was to add the full path for rmmod to the script file, i.e /usr/sbin/rmmod ehci_pci

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .