January 12, 201610 yr I set up a custom script as described here. It works fine when I run it from the command line, but when I run it as a cron job I get this in the log- Jan 11 20:00:01 Brunnhilde crond[1609]: exit status 127 from user root ./config/plugins/DS_Store-Cleanup/rmdotstore.sh /mnt/user/Media && /usr/local/emhttp/plugins/dynamix/scripts/notify -e "DS_Cleanup" -d "Removing .DS_Store files" -i "normal" -m "Cleaning DS_Store files from Media" Jan 11 20:00:01 Brunnhilde sSMTP[20054]: Creating SSL connection to host Jan 11 20:00:02 Brunnhilde sSMTP[20054]: SSL connection using AES128-GCM-SHA256 Jan 11 20:00:03 Brunnhilde sSMTP[20054]: 550 5.7.0 From address is not one of your addresses. The .DS_Store files are not being deleted and I don't get a notification. Not sure why it's failing. I've attached the complete log. brunnhilde-syslog-20160111-2008.zip
January 12, 201610 yr Not sure if it'll make a difference but try changing it from ./config to /boot/config
January 12, 201610 yr Author Didn't work. DS Store files are still not being deleted and I'm still getting errors in the log that the "From" is not one of my email addresses.
January 12, 201610 yr The big question is does the script work. If it does (and I seem to recall that it does) then its something with the cron
January 12, 201610 yr Author It worked when I ran it via telnet. Deleted test files I had saved to the share and sent the proper notifications. The log shows the script is running on time. The only difference I can see is that when I run the script via telnet I have to cd /boot first. Not sure if that changes anything. Edit- I see a typo (DUH). I changed the script per your suggestion but typed in boot/config instead of /boot/config. Fixed now and I'll see what happens.
January 13, 201610 yr Author Thanks again Squid. Fixed the typo and everything is working. DS Store file was deleted and notifications worked. Still have the error in the log that the "From" address is not one of my addresses. Not sure what's causing that but notifications still work.
January 13, 201610 yr Just for something to do, add an exit 0 to the end of your script. I *believe* (fully prepared to be wrong) that crontab tries to email root in the event of an abnormal exit. (and maybe the last iteration of your find command is actually returning a non zero return code)
January 13, 201610 yr Author Like this? # DS_Store Cleanup for Media: 40 3 * * 3 /boot/config/plugins/DS_Store-Cleanup/rmdotstore.sh /mnt/user/Media && /usr/local/emhttp/plugins/dynamix/scripts/notify -e "DS_Cleanup" -d "Removing .DS_Store files" -i "normal" -m "Cleaning DS_Store files from Media" && exit 0
January 13, 201610 yr Author I think you're talking about the sh script- #!/bin/bash # ========================================================================== # # Program Body # # ========================================================================== # ((!$#)) && echo No Directory supplied! && exit 1 dir="$@" echo $dir echo "Removing .DS_Store files" find "$dir" -name ".DS_Store" -exec rm '{}' \; -print echo "=======================" echo "Removing ._ files" find "$dir" -name "._*" -exec rm '{}' \; -print Should I add the exit after the find at the bottom?
January 13, 201610 yr Author Tried with both scripts and every combination I could think of. None made any difference. Seems to be working though, so it's really a minor issue.
Archived
This topic is now archived and is closed to further replies.