My suspicion is that the cron job is "/bin/sh -c /tmp/scripts/log_to_elk.sh &> /etc/GET_CronJobs/script1_cron.txt", which is running a separate shell to run your script. In other words, one process is the shell, and the second is the script in that shell.
Use the "#!/bin/sh", called a shebang, at the top of your script if you need to specify a specific shell, rather than launching a shell in the cron job. To confirm my suspicion, are you getting duplicate data in your script1_cron.txt file? Jeremiah Bess <https://plus.google.com/u/0/103182072532361592558> <https://www.facebook.com/jeremiahbess> <http://www.linkedin.com/profile/view?id=47451026> On Fri, Apr 17, 2015 at 2:48 AM, Ch Ravikishore < [email protected]> wrote: > Hi, > I a using a cron to run this script for every 3 hours. > crontab -l results > 0 */3 * * * /tmp/scripts/script1.sh &> /etc/GET_CronJobs/script1_cron.txt > > Script is no where available even cron.hourly (I checked those). But still > it is running twice. > Please suggest me the solution. > > > [root@ilreplica ~]# ps -ef | grep script1.sh > root 2484 2482 0 12:00 ? 00:00:00 /bin/sh -c > /tmp/scripts/log_to_elk.sh &> /etc/GET_CronJobs/script1_cron.txt > root 2488 2484 0 12:00 ? 00:00:00 /bin/sh -c > /tmp/scripts/log_to_elk.sh &> /etc/GET_CronJobs/script1_cron.txt > root 3467 3232 0 14:11 pts/2 00:00:00 grep script1.sh > > Thanks in advance, > > Regards, > Ravi > > -- > -- > You received this message because you are subscribed to the Linux Users > Group. > To post a message, send email to [email protected] > To unsubscribe, send email to [email protected] > For more options, visit our group at > http://groups.google.com/group/linuxusersgroup > References can be found at: http://goo.gl/anqri > Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules > or http://cdn.fsdev.net/List-Rules.pdf) > > --- > You received this message because you are subscribed to the Google Groups > "Linux Users Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup References can be found at: http://goo.gl/anqri Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf) --- You received this message because you are subscribed to the Google Groups "Linux Users Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
