N
N
Nikita Shvetsov2011-12-05 23:17:20
linux
Nikita Shvetsov, 2011-12-05 23:17:20

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

5 answer(s)
D
Denis, 2011-12-06
@uscr

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

N
Nikolai Turnaviotov, 2011-12-14
@foxmuldercp

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 :)

K
kreativf, 2011-12-05
@kreativf

Maybe the user under which the cronjob is running does not have enough rights?

A
Andrey Grigoriev, 2011-12-05
@eigrad

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 ...

A
AnViar, 2011-12-05
@AnViar

Replace Desktop with Desktop, it seems it's just a display, not sure, can't check

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question