Jump to content

problems running custom script / notification errors


wgstarks

Recommended Posts

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

Link to comment

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.

Link to comment

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)

Link to comment

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

 

Link to comment

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?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...