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

    Why clog command line in shell script does not run by crontab

    Scheduled Pinned Locked Moved General pfSense Questions
    3 Posts 2 Posters 2.4k 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.
    • P
      poomsag
      last edited by

      my shell script file's contains
      clog -i -s 2097120 /var/log/system.log
      clog -i -s 2097120 /var/log/filter.log
      clog -i -s 512144 /var/log/dhcpd.log
      clog -i -s 512144 /var/log/vpn.log
      clog -i -s 512144 /var/log/openvpn.log
      clog -i -s 512144 /var/log/portalauth.log
      clog -i -s 512144 /var/log/ipsec.log
      clog -i -s 512144 /var/log/slbd.log
      clog -i -s 512144 /var/log/lighttpd.log
      clog -i -s 512144 /var/log/ntpd.log
      it's work properly when run shell script by command line,but not work when run by crontab

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

        You need the full path to clog in a script. It inherits the path from your shell, but that is not present when running from cron and such.

        Use /usr/sbin/clog to start each line.

        Why are you clearing the logs from cron, anyhow?

        They are circular logs, they will never grow in size or fill up any more space than they do when created.

        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
        • P
          poomsag
          last edited by

          Thank you  :)
          I must backup every log files every days.
          I don't want to let it truncate log file before backup.

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