0

I apologise for the re-post.

However I am just trying to get crontab to call one for my shell files.

I have tried every variation of the command but it will not run it.

The code is

* * * * * /home/ubuntu/BenchScripts/rRead.sh

Is there something I am missing ?

.sh file

#!/bin/bash

echo "Starting test" $(date +"%H:%M:%S") > rReadResults.txt

echo "Starting test" $(date +"%H:%M:%S") >> rRead.txt

sysbench --num-threads=1 --test=fileio --file-total-size=3G --file-test-mode=rndrd prepare
sysbench --num-threads=1 --test=fileio --max-time=300 --file-total-size=3G --file-test-mode=rndrd run >> rReadResults.txt
sysbench --num-threads=1 --test=fileio --file-total-size=3G --file-test-mode=rndrd cleanup

echo $(grep 'Total transferred' rReadResults.txt) >> rRead.txt

echo "--------------------------------------------------------------------------------" >> rRead.txt

rm rReadResults.txt
troylatroy
  • 1,275
  • 1
  • 11
  • 21
DugD
  • 1
  • My guess is there is a problem with the script and not cron . Cron runs in a minimal shell with minimal environmental variables.Post your script for debugging. Simply stating that you are having a problem is insufficient information. See also http://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job – Panther Dec 02 '16 at 16:59
  • I agree with bodhi.zazen. There is also one more thing. For which user the crontab runs. Is it possible that the crontab user is not ubuntu and it does not have acces to /home/ubuntu/BenchScripts/rRead.sh? I am not sure which log crontab uses. Is there anything in /var/log/syslog about failed crontab executions? – nobody Dec 02 '16 at 17:02
  • 1
    Did you make sure it's executable? If not run sudo chmod +x rRead.sh – troylatroy Dec 02 '16 at 17:05
  • Use the full path to files and executables. cron does not know where "sysbench" is located nor where the *.txt files are . Use full path in cron – Panther Dec 02 '16 at 17:36

0 Answers0