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 is not generating with cron
The above will script will do
1) Indivisual backfiles will stored in bngbackup directory after running expect command --- upto this code is working
2) Iam compressing the bngbackup directory with below command
tar -cf bngbackup.tar bngbackup ;gzip bngbackup.tar
its not working in cron.what wrong with my code.can any body help . Iam running the code on solaris 10 OS.
vbe
February 15, 2013, 10:56am
2
Did you look in your cron logs?
What is the expect doing here? Does that work with cron?
panyam
February 15, 2013, 10:59am
3
Are you capturing the log of the script any where?
I guess , the gzip may not be available in path!!!..
Do this,issue below command:
$ which gzip
copy the above path and use it in the script , instead of using gzip directly.
1 Like
Hi,
Expect is working with cron. it will store the backup files in bngbackup directory
after this only problem is coming.
the below command is not working in cron
tar -cf bngbackup.tar bngbackup ;gzip bngbackup.
but while executing manually bngbackup.tar.gz was created
vbe
February 15, 2013, 11:18am
5
looks like panyam is correct: You either have to set PATH in your script or give the path to your commands as you did with expect... For gzip is not standard on all UNIX and you did not say what OS you were using, this may very well be the culprit and good candidate for "not found" messages...
Hi
I added path in the script. Now file was created using cron
/usr/bin/tar -cf bngbackup.tar bngbackup ;/usr/bin/gzip bngbackup.tar
Tnx to all