Uploaded image for project: 'TrueNAS'
  1. TrueNAS
  2. NAS-106295

blank write output from cron script (TN NUU-790-20846)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Engineering Closed (View Workflow)
    • Priority: Low
    • Resolution: Won't Do
    • Affects Version/s: TrueNAS 11.2-U8.1
    • Fix Version/s: N/A
    • Component/s: Tasks
    • Labels:
      None

      Description

      "I've created a one-liner shell script that shows Samba locks, cross-referencing the userIDs to the Windows Directory and producing text that I redirect to a file. I would like to run this script periodically and have it output to a share, where users can see who has their file(s) locked. To that end, I have created a cron job using the WebUI. Unfortunately, I can't seem to get the cron user environment right -- the script runs on schedule, but the resultant text file is blank. I've tried running the script using different users, including root, as well as sourcing profiles from within the script, to no avail.

      Can you please try to reproduce and see if you are able to get it to run under cron? Here is the one-liner:

      smbstatus -L | sed -e '1,3d' | tr -s " " | cut -d' ' -f2,7,8 | sed '/^$/d' | sort -k2,3 | awk '{print "\n" $2"/"$3;system("wbinfo --uid-info="$1"|cut -d ':' -f1") }'

      It produces text in the following format:

      ...
      /mnt/pool0/smb-data/users/kamen/DFARS/CMMC/CMMC_Model_Appendices_20200203.docx
      SSCP\kamen

      /mnt/pool0/smb-data/users/kamen/DFARS/CMMC/CMMC_Model_Appendices_COPY.pdf
      SSCP\kamen

      /mnt/pool0/smb-data/users/kamen/DFARS/Take2
      SSCP\kgraves

      /mnt/pool0/smb-data/users/kamen/DFARS/Take2
      SSCP\kgraves

      /mnt/pool0/smb-data/users/kamen/DFARS/Take2/Training
      SSCP\kgraves
      ...

      Thanks in advance."

        Attachments

          Attachments

            JEditor

              Activity

                People

                Assignee:
                releng Triage Team
                Reporter:
                slionberger Sophia Lionberger [X] (Inactive)
                Watchers:
                Sophia Lionberger [X] (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: