First, there is an error in your script paleoN. I questioned it in my head for a second or two before pasting and didn't look it over.
Your script:
Code:
#!/bin/bash
ls -ltd1 /mnt/tank/Backups/Desktop/* | grep ".*\.omg" | tail +3 > /tmp/list && xargs rm < list
ls -ltd1 /mnt/tank/Backups/HTPC/* | grep ".*\.omg" | tail +3 > /tmp/list && xargs rm < list
ls -ltd1 /mnt/tank/Backups/Laptop/* | grep ".*\.omg" | tail +3 > /tmp/list && xargs rm < list
Notice that at the end of the line you have
list instead of
/tmp/list. Whoops!
So.. with that in mind I fixed my script, made a test folder and files and adjusted the script to go to the test folder and files.
But, with the #!/bin/bash I still get the email "/mnt/tank/.config-backup/backup-cleanup.sh: not found"
Without the #!/bin/bash I get no email and
SUCCESS! It deleted my test files appropriately.
But now I'm left with the question why the other script didn't work before. It should have...
So now I've fixed the script to point to the backup folders, adjusted the cronjob time so it ran 1 min in the future and... it didn't work. Back to "cannot open /tmp/list: No such file or folder"
Strangely, I checked and the /tmp/list file
is there and
does contain the correct filenames!
Code:
/mnt/tank/Backups/Desktop/DESKTOP-02-15-2013.omg
/mnt/tank/Backups/Desktop/DESKTOP-02-01-2013.omg
/mnt/tank/Backups/Desktop/DESKTOP-01-25-2013.omg
Using
#!/bin/bash is out of the question for my scripts though. I even tried touching a file after the
#!/bin/bash and it doesn't touch the file. Anytime I add
#!/bin/bash I get a guaranteed email saying "/mnt/tank/.config-backup/backup-cleanup.sh: not found". As soon as I get rid of it the script runs fine.
I looked at my other scripts that execute fine(all of my other scripts are executing fine as scheduled) and they have
#!/bin/sh. I tried changing my script to have that at the beginning.. another "/mnt/tank/.config-backup/backup-cleanup.sh: not found" error.
So I changed the script to simply say "touch /mnt/tank/1.txt" to see what happens. When it ran I ended up with a file named "1.txt?" If I go to that location from Windows Explorer the filename is 1RKJB3~L. I get the same thing if I go to /tmp. I actually did see a /tmp/list? file once or twice but disregarded the question mark as a typo. Weirdness!
So any guesses what the heck that means? I'm about to do a reboot just because I'm desperate. I'm starting to wonder if my FreeNAS installation is somehow corrupted. I'm having no other issues at all with the system besides this one. I'm running FreeNAS-8.3.0-RELEASE-p1-x64 (r12825) and I don't believe I ever used any non-release versions or upgraded to this version.
Edit: Actually, I'm gonna wait on a reboot. Maybe someone can recommend a log file for me to look at that would be wiped on reboot.