Help - Search - Members - Calendar
Full Version: Cron / Script problem CentOS 6
Linuxhelp > Support > Programming in Linux
Len
I have a cron.d file set to run a bash shell script - and it isn't working . . .
I have restarted cron

I have the following file in /etc/cron.d
* 20 * * 1,2,3,4,5 root /opt/squid/etc/squid-nights Permissions on the file are: -rw-r--r-- (same as all the jobs/scripts in /etc/cron.d/)


If I run '/opt/squid/etc/squid-nights' from the command line as root it does what it is supposed to do which is run the following file (which does what it is supposed to do if I run from command line as root):

#!/bin/bash
rm -f /opt/squid/etc/squid.conf
sleep 1s
cp /opt/squid/etc/squid.nightsweekends /opt/squid/etc/squid.conf
sleep 1s
chown squid:squid /opt/squid/etc/squid.conf
killall squid
sleep 1s
killall squid
sleep 1s
killall squid
sleep 1s
/opt/squid/sbin/squid

Permissions on the script file are: -rwxr-xr-x
michaelk
Did you restart cron?
FYI * 20 * * 1,2,3,4,5 will run each minute at 2000 hours i.e 60 times. I would guess you only want it to run once a day.
00 20 * * 1-5 wll run week nights at 2000 hours.
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.