Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Cron / Script problem CentOS 6, Works when run as root
Len
post Feb 16 2012, 03:33 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 16-February 12
Member No.: 17,440



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
Go to the top of the page
 
+Quote Post
michaelk
post Feb 17 2012, 12:33 PM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th December 2017 - 08:08 AM