LinuxQuestions.org
Review your favorite Linux distribution.
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 05-14-2013, 01:54 PM   #1
Bharath_
LQ Newbie
 
Registered: May 2013
Posts: 7

Rep: Reputation: Disabled
Unhappy Command associated with Incron not getting executed


Hi,

I am trying to synchronize my servers using unison. I have a master and slave pattern. So when i make changes in the master i want my unison script to be executed. I am using incrontab -e to watch my folder and have put this line inside it /usr/share/nginx/html IN_ALL_EVENTS /bin/sh /root/scripts/sync.sh

But when i make changes in my html folder the abouve statement is not getiing executed. When i see the log i get a message

May 14 12:52:36 Nginx1 incrond[15788]: (root) CMD ( /bin/sh /root/scripts/sync.sh)
May 14 12:52:36 Nginx1 incrond[15788]: (root) CMD ( /bin/sh /root/scripts/sync.sh)
May 14 12:52:36 Nginx1 incrond[15792]: cannot exec process: No such file or directory
May 14 12:52:36 Nginx1 incrond[15793]: cannot exec process: No such file or directory
May 14 12:52:41 Nginx1 incrond[15788]: (root) CMD ( /bin/sh /root/scripts/sync.sh)
May 14 12:52:41 Nginx1 incrond[15795]: cannot exec process: No such file or directory

Can anyone tell me why my statement is not getting executed..
 
Old 05-14-2013, 08:14 PM   #2
Kenarkies
Member
 
Registered: Nov 2007
Location: South Australia
Distribution: Ubuntu 11.10
Posts: 80

Rep: Reputation: 23
Well I don't really want to be seen to be stating the obvious, but I assume you have verified that /root/scripts/sync.sh does exist (watch spelling and upper/lower case) and is executable. Sometimes a small spelling error just seems to be invisible to even the most experienced user. Also are there any references to paths within sync.sh that might be invalid?

Probably a good idea to move the script out of the root home directory but that's only an opinion. It shouldn't make a difference where it is put as long as it is accessible.
 
Old 05-14-2013, 08:40 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
It looks like there's something in the sync.sh script that cron doesn't like.
You could check your email on the box to (or root's) to see if it sent you an email.
Try using bash instead of sh; its more capable. Put it at the top of the script thus '#!/bin/bash' and drop the external call.
Add 'set -xv' next at the top of the script; it'll show you what the parser sees/does & then ensure you capture stdout+stderr to a file to check results.
Code:
/usr/share/nginx/html IN_ALL_EVENTS  /root/scripts/sync.sh >/tmp/sync.log 2>&1
 
Old 05-15-2013, 12:44 PM   #4
Bharath_
LQ Newbie
 
Registered: May 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hi chrism01,

I tried /usr/share/nginx/html IN_ALL_EVENTS /root/scripts/sync.sh >/tmp/sync.log 2>&1
But i noticed that there was no file created in /tmp. I think the command is not getting executed. how can i solve this..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Why any command in .bashrc is being executed twice lxas Linux - Newbie 7 02-28-2013 08:43 PM
ShellScript executed from command prmpt but not executed from crontab or at command BMMadhav Linux - Newbie 1 11-16-2012 08:20 PM
time when a command was executed. anandkj Linux - Newbie 3 12-21-2007 02:09 AM
how to see which command has been executed ? Volcano Linux - Newbie 4 12-11-2006 09:48 AM
which command executed on which terminal dsids Linux - Newbie 1 09-23-2006 09:57 AM


All times are GMT -5. The time now is 08:46 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration