LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   crontab (https://www.linuxquestions.org/questions/linux-newbie-8/crontab-4175458284/)

amartlk 04-16-2013 03:04 AM

crontab
 
Hi

i have centos 5.3 installed and make one script and want this script is scheduled at crontab script is as follows
#!/bin/bash
cp /safe/test /etc/
service squid restart


i schedule crontab but when crontab is run at schedule time then only first command of script i.e cp /safe/test /etc/ is run but the second command service squid restart not run

i also tried /etc/init.d/squid restart instead of service squid restart but it also not run

PierreB. 04-16-2013 05:33 AM

Hi amartlk,

The first thing you might want to check (if not already done) is to restart the service manually, outside of any script or cronjob.

You could also check the cron log
Code:

/var/log/cron
to check what's going on.

You can try to run the script manually with the bash debug flag
Code:

bash -x /path_to_your/script.bash
to checkif it runs as expected.


Let us know what are the results for those 3 steps.

amartlk 04-16-2013 06:23 AM

Hi

i solved myself i user /etc/init.d/squid restart it works

PierreB. 04-16-2013 06:25 AM

Glad you solved it. What was the problem by the way ?


All times are GMT -5. The time now is 04:15 PM.