Navigation

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

    Cron job not running

    General pfSense Questions
    3
    4
    2042
    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.
    • T
      torontob last edited by

      Hi Everyone,

      I have installed the cron package and I have also tried with "crontab -e" but both methods fail for the following script:

      #!/bin/sh
      DATErand=`date +%s`
      cp /tmp/faxspin.avi /tmp/faxspin-$DATErand.avi
      wput /tmp/faxspin-$DATErand.avi ftp://anonymous:pass@ftp.com/public/incoming/
      rm -rf /tmp/faxspin-$DATErand.avi
      

      File privilges: -rwxr-xr-x  1 root  wheel  229 Sep 13 22:06 /usr/bin/wput.sh

      There is no indication that the script file is run as there is no faxspin-$DATErand.avi is created. This works just fine if I run this script from shell.

      Please advise.

      Thanks,

      1 Reply Last reply Reply Quote 0
      • C
        cmb last edited by

        On the wput line, use the full path to wput. That may be the only issue.

        1 Reply Last reply Reply Quote 0
        • T
          torontob last edited by

          This is exactly what I have in the cron:

                  • root /usr/bin/wput.sh

          And here is the change I made per your suggestion to no avail:

          #!/bin/sh
          DATErand=date +%s
          cp /tmp/faxspin.avi /tmp/faxspin-$DATErand.avi
          /usr/local/bin/wput /tmp/faxspin-$DATErand.avi ftp://anonymous:pass@ftp.com/public/incoming/
          rm -rf /tmp/faxspin-$DATErand.avi

          How can I see the logs as to what really happens? if logs are not turned on for cron, how can I turn it on.

          Thanks

          1 Reply Last reply Reply Quote 0
          • jimp
            jimp Rebel Alliance Developer Netgate last edited by

            The logs for cron are not configured in syslog – however, if you enable remote syslog, and tell it to send "everything" it will also forward the logs for cron to a remote box where you can see them.

            In a cron script, always make sure you use the full path to every command - even date, cp, rm, etc. That or at the start of the script, set your own PATH variable to include the directories where the binaries you need lie.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post