Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Crontab does not works

    Scheduled Pinned Locked Moved General pfSense Questions
    cronshell scriptshell
    2 Posts 2 Posters 602 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      miki_teleco
      last edited by miki_teleco

      Hi,

      I have this dummy cronjob.

      [root@fw /home/user/watchdog_snort]# crontab -l | tail -1
      */1 * * * * root /bin/bash /home/user/watchdog_snort/dummy.sh
      [root@fw /home/user/watchdog_snort]# cat /home/user/watchdog_snort/dummy.sh
      #!/bin/bash
      echo "prueba" > /home/user/watchdog_snort/watchdog_logs
      
      [root@fw /home/user/watchdog_snort]# wc -l watchdog_logs
             0 watchdog_logs
      [root@fw /home/user/watchdog_snort]# env -i SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin HOME=/root LOGNAME=dru /home/user/watchdog_snort/dummy.sh
      [root@fw /home/user/watchdog_snort]# wc -l watchdog_logs
             1 watchdog_logs
      

      As you can see, the script works fine even with the cron env. However, dummy script does not works in a cron schedule.
      Have you got any ideas about why It is happening?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        /bin/bash doesn't exist in pfSense, use /bin/sh.

        What error do you see when it tries to run?

        Steve

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.