LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-16-2013, 03:04 AM   #1
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Rep: Reputation: 1
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
 
Old 04-16-2013, 05:33 AM   #2
PierreB.
Member
 
Registered: Apr 2012
Location: Grenoble
Distribution: Rhel[456],CentOS[56],fedora18
Posts: 33

Rep: Reputation: Disabled
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.

Last edited by PierreB.; 04-16-2013 at 05:34 AM.
 
Old 04-16-2013, 06:23 AM   #3
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
Hi

i solved myself i user /etc/init.d/squid restart it works
 
Old 04-16-2013, 06:25 AM   #4
PierreB.
Member
 
Registered: Apr 2012
Location: Grenoble
Distribution: Rhel[456],CentOS[56],fedora18
Posts: 33

Rep: Reputation: Disabled
Glad you solved it. What was the problem by the way ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux crontab vs unix crontab ytd Linux - General 2 08-09-2009 05:07 AM
replaced crontab, now should get crontab back to what it was raminn Linux - Newbie 2 10-20-2008 07:15 PM
man crontab(5) vs crontab(1) Canis Polaris Linux - Newbie 2 06-04-2008 04:03 PM
crontab tux_processor Linux - General 5 06-07-2007 10:10 PM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration