Answer the question
In order to leave comments, you need to log in
Cron not executing part of script?
Goodnight.
I have such a problem - cron does not execute part of the script.
Content of crontab:
*/5 * * * * /bin/bash "/home/thaves/Desktop/serv_temp.sh"
Content of script:
#!/bin/bash
echo "############ ###################################" >> "/home/thaves/Desktop/temp_serv.txt "
date >> "/home/thaves/Desktop/temp_serv.txt"
/usr/bin/dsh -g home_servers -M -c "uptime" >> "/home/thaves/Desktop/temp_serv.txt"
/usr /bin/dsh -g home_servers -M -c "sensors | grep temp" >> "/home/thaves/Desktop/temp_serv.txt"
/usr/bin/dsh -g home_servers -M -c "hddtemp /dev/sda" >> "/home/thaves/Desktop/temp_serv .txt"
###############################################
_ dec. 5 23:25:01 MSK 2011
########################################## #####
Tue. dec. 6 00:25:53 MSK 2011
########################################## #####
Tue. dec. 6 00:30:01 MSK 2011
What is the matter and how to deal with it?
Answer the question
In order to leave comments, you need to log in
In the crown cap there is this: ?
These seemingly useless variables sometimes have a magical effect on the execution of scripts.
Have you tried putting all the commands in one script and running it?
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
Isn't it easier not to fence the bike on to set up nagios and nagios plugins in several commands?
He will also send email :)
Maybe the user under which the cronjob is running does not have enough rights?
Try to specify the full paths in the script everywhere - uptime, sensors, hddtemp may not be in the PATH with which dsh runs commands. Well, or you can initialize PATH somehow. It should also write somewhere in the logs what the problem is there ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question