- Joined
- May 28, 2011
- Messages
- 10,972
I've been messing with this all day and searching the internet for help but I have tried many things, nothing has helped.
I'm trying to execute the following script which works fine running under SU in SSH. Might I add, I believe I need to use SU/root for the smartctl command.
In CRON I had set it up like this:
User: root
command: sh /mnt/farm/email/esmart.sh /dev/ada0
Even forcing the /dev/ada0 in the script and removing it from the command line gives no joy.
I currently am using a location on the pool vice on /tmp or somewhere else which is my final goal so I don't have to spin up the drives just to run this command.
I have simplified this drastically in many ways, used explicit paths, and I'm now to the point of having to ask for assistance. There must be something obvious I'm overlooking which is why I hate to ask a stupid question.
EDIT: I think my problems are in the redirects. It's driving me nuts.
Thanks,
Mark
I'm trying to execute the following script which works fine running under SU in SSH. Might I add, I believe I need to use SU/root for the smartctl command.
In CRON I had set it up like this:
User: root
command: sh /mnt/farm/email/esmart.sh /dev/ada0
Even forcing the /dev/ada0 in the script and removing it from the command line gives no joy.
I currently am using a location on the pool vice on /tmp or somewhere else which is my final goal so I don't have to spin up the drives just to run this command.
Code:
#!/bin/sh # # Script to email Drive Results # Usage: esmart.sh drive path # Example: sh esmart.sh /dev/ada0 switch1=$1 ( echo "To: joe@email.net" echo "Subject: SMART Drive Results for ${switch1}" echo " " ) > /mnt/farm/email/cover smartctl -i -H -A -l error ${switch1} >> /mnt/farm/email/cover sendmail -t < /mnt/farm/email/cover
I have simplified this drastically in many ways, used explicit paths, and I'm now to the point of having to ask for assistance. There must be something obvious I'm overlooking which is why I hate to ask a stupid question.
EDIT: I think my problems are in the redirects. It's driving me nuts.
Thanks,
Mark