Help - Search - Members - Calendar
Full Version: Trouble With Cron
Linuxhelp > Support > Technical Support
Bender
Hi all
I having some trouble getting a script that I made to work properly in cron
It works fine when I run it myself in console

This script is supposed to create/update a couple of files in /tmp but does not do that when runned in cron blink.gif
The program that is used in the script, afacli is a raid command line interface

script and crontab entry follows:

crontab:
0-59/5 * * * * /root/cron

script:
#!/bin/bash

echo "Setting variables"
#
# Setting variables
#
PROGRAM=/usr/sbin/afacli
CONTROLLER=afa0
TEMPERATURE_LOG=RAID.temp
DRIVE_LOG=RAID.drives
DIRECTORY=/tmp

echo "logfile names cannot contain a path so..."
#
# logfile names cannot contain a path so...
#
cd ${DIRECTORY}
echo `pwd`

echo "remove old status files"
rm ${TEMPERATURE_LOG}
rm ${DRIVE_LOG}

echo "Generate temperature status file"
#
# Generate temperature status file
#
${PROGRAM} >/dev/null 2>&1 <<!
open/readonly ${CONTROLLER}
logfile start ${TEMPERATURE_LOG}
enclosure show temp
logfile end
exit
!

echo "Generate drive status file"
#
# Generate drive status file
#
${PROGRAM} >/dev/null 2>&1 <<!
open/readonly ${CONTROLLER}
logfile start ${DRIVE_LOG}
enclosure show slot
logfile end
exit
!




Any Ideas ?
Joey
Is this the full entry in your crontab:

0-59/5 * * * * /root/cron


If so, you haven't told it what program/script to run.

An example of an entry is:

52 5 * * * root /usr/local/bin/analog >> /dev/null 2>&1
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.