Script not working in cron but working fine manually


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered.

The script is as follow:
Code:
#!/bin/sh 

for file in file_1.txt file_2.txt file_3.txt
do
    awk '{ print "0" }' $file > tmp.tmp
    mv tmp.tmp $file
done


And the cron job I am making is:
Code:
*/2 * * * * /root/folder/test.sh

Thanks for the help.

Last edited by Franklin52; 07-05-2012 at 07:29 AM.. Reason: Please use code tags for data and code samples, thank you
# 2  
provide the absolute path of file_1.txt... file_2.txt...

Code:
 
for file in file_1.txt file_2.txt file_3.txt

Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Automating pbrun /bin/su not working, whenever manually it is working using putty
jorgejac
I am trying to automate a script where I need to use pbrun /bin/su but for some reason it is not passing thru the pbrun as my code below. . ~/.bash_profile pbrun /bin/su - content c h 1 hpsvn up file path I am executing this from an external .sh file that is pointing to this scripts file...... Shell Programming and Scripting
14
Shell Programming and Scripting
Shell script not getting called through cron job but executes fine manually.
Dejavu20
Hi, My shell script not getting called through cron job. The same works fine when executed manually. I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins: */5 * * * * /home/myfolder/abc.sh...... Shell Programming and Scripting
17
Shell Programming and Scripting
Getting issue while running it from cron while manually working fine
anuragpgtgerman
Hello, I am working one one script where I am using the below code which is using to connect with MKS client when I run my script manually it works effiecently i.e. it connects with MKS client but when I run it from CRON it doesn't connect. 1)Can some one tell when it is running from cron...... Shell Programming and Scripting
1
Shell Programming and Scripting
Script is not working from cron while working manually
anuragpgtgerman
Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like...... Shell Programming and Scripting
3
Shell Programming and Scripting
GUI not working... CLI is working fine
bharu_sri
Hello, I have X4500 running Solaris 10. I can access it through CLI but I cannot see the GUI. When I reboot it, the GUI works till all the files are loaded (ie., the initial boot sequence) and it prompts me to enter username and password and there it ends. The screen just has a blinking cursor...... Solaris
4
Solaris