crontab using shell script to sync files.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting crontab using shell script to sync files.
# 1  
Old 06-27-2012
Error crontab using shell script to sync files.

Hi,

I developed one shell script where it will sync the files using perforce,
Code:
#!/bin/bash
TERM=linux
export TERM

clear
echo ""
$PATH
echo ""
cd /u/userk/p4/p4_client/TES_DATE
echo ""

echo "Sync p4 "
p4 sync

echo "Executing for second time "
p4 -u userk -p p4net:161 -c userk:p4_client sync

this script executes well when i execute from my directory, i want this script to run every 15 min, and sync the latest files using perforce(p4) so i am using cronjob to achive this, my crontab files goes like this
Code:
MAILTO=userk@abensdes.com
*/15 * * * * /u/userk/auto_sync_p4.sh

this cronjob is executed, but files are not synced , and i am getting
Code:
p4 command not found.

Please let me know how to execute p4 command from cronjob.

Regards,
asak
# 2  
Old 06-27-2012
Perhaps "p4" command is not in your PATH.
use the fully qualified path for p4. like .

Code:
/some/path/p4 sync

# 3  
Old 06-27-2012
Hi Clx,

i tried by giving complete path getting like this,
Code:
/u/userk/p4/p4_client/p4: No such file or directory

and one more thing, i am going into the directory where p4 is present using cd and then i
am executing p4 sync.

Code:
echo ""
cd /u/userk/p4/p4_client/TES_DATE
echo ""

echo "Sync p4 "
p4 sync

Regards,
asak
# 4  
Old 06-27-2012
Code:
 
cd /u/userk/p4/p4_client/TES_DATE
echo ""

echo "Sync p4 "
p4 sync

Code:
 
i tried by giving complete path getting like this,


Code:
/u/userk/p4/p4_client/p4: No such file or directory

# 5  
Old 06-27-2012
Hi itkamaraj,

Giving complete path also gives the same error,

Code:
/u/userk/p4/p4_client/TES_DATE/ p4: No such file or directory

Regards,
asak
# 6  
Old 06-27-2012
still, i see the space in between the DATE/ and p4

Code:
 
/u/userk/p4/p4_client/TES_DATE/ p4

# 7  
Old 06-27-2012
I tried with space and also without space, p4 is a command so i tried giving with space , still same i am getting, the script runs fine when i execute from my home directory, but when i execute from cronjob, it shows p4 command not found or No such file or directory
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Schedule a shell script without crontab every Wednesday at 10 AM

HI Guys I need one shell script to be scheduled to run one shell script to be executed automatically every Wednesday at 10 AM Without crontab and "at" command.. Could you provide your suggestions ? Thanks and Regards kshitij Kulshreshtha (6 Replies)
Discussion started by: kshitij
6 Replies

2. Shell Programming and Scripting

[Solved] Shell script not working in crontab

Hi Iam running below script in crontab but its not working. #!/bin/sh cd /Scripts /usr/local/bin/expect -f /Scripts/bng_backup.exp /Scripts/data.txt tar -cf bngbackup.tar bngbackup ;gzip bngbackup.tar when iam running manually the output file is generating..but bngbackup.tar.gz file... (5 Replies)
Discussion started by: surender reddy
5 Replies

3. Shell Programming and Scripting

Wants to change shell script into crontab

Hi friends, Actually i wrote many scripts in korn shell for time saving activity in storage domain. But every week i am spending some time for the running of script. So every Monday i wants to run my scripts automatically. So corn will be helpful according to my friend's opinion. But I don't... (5 Replies)
Discussion started by: Mahendranath
5 Replies

4. Shell Programming and Scripting

use crontab for a shell script..

hi, i have shell script which checks for service running on platform, if service is receiving calls, then do nothing if service is not receiving calls, then stop the service i want to run this script in 2 timeslots. i.e. in the day from 9 am to 5 pm it should run every 10 minutes and ... (2 Replies)
Discussion started by: gauravah
2 Replies

5. Shell Programming and Scripting

Korn shell script to sync/move files that are not in use

Hello all. This may seem like a dumb/easy question but right now I have a little script I made that uses rsync to sync a directory that has files in it that may or may not be complete files. I want to come up with a better solution for this. What it is is I have a directory lets say /incomplete... (4 Replies)
Discussion started by: linuxn00b
4 Replies

6. Shell Programming and Scripting

Change crontab from shell script

Hi All, I have scheduled a script to run every five minutes through crontab. If there is any issue with the script which may need manual intervention, I have used the mailx commands. But at the same time, I would want the cron to be disabled until the issue is resolved. Once things are fine,... (2 Replies)
Discussion started by: adi_2_chaos
2 Replies

7. Shell Programming and Scripting

Adding a job to crontab via shell script

Is it possible to add a job to crontab with a shell script? The existing jobs in the crontab should exist as it was. The new job should be appended. Also, the crontab file is /var/spool/cron/root. (1 Reply)
Discussion started by: proactiveaditya
1 Replies

8. Shell Programming and Scripting

Can we edit crontab using a shell script

Hi, Can some one tell me if we can configure the jobs in crontab using a shell script. I know it can be done easily by using "crontab -e", but i just want to know whether we can add a job into the crontab using a shell script. If it can be done, plz suggest the procedure to do it. If it... (6 Replies)
Discussion started by: rudrarajumk
6 Replies

9. Shell Programming and Scripting

How do i run a shell script without crontab.

Hi Folks, Could you please suggest me how to run a shell script on a solaris env without using crontab. I am actually trying to write a shell script which will grep "WORD" in the logfile andd sends a email.Thanks in advance. Thanks Sandeep. (3 Replies)
Discussion started by: sandeep anand
3 Replies

10. Shell Programming and Scripting

crontab and shell script that executes a sql.

Problem: I have a crontab and when it kicks off, xxx.sh shell script is called. Which has a nohup sqlplus session call. Problem is sql does not get executed and a text file is not getting created. Only a empty log file is getting created. Are there any constraints for crontab to open a sql... (6 Replies)
Discussion started by: radhika
6 Replies
Login or Register to Ask a Question