![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help making a shell script that converts files in a directory | wingchun22 | Shell Programming and Scripting | 15 | 09-18-2008 12:03 AM |
| Problem in making shell script | girish.batra | Shell Programming and Scripting | 4 | 02-08-2008 09:10 AM |
| making script | shary | Shell Programming and Scripting | 2 | 06-03-2007 04:16 PM |
| Need help making a script | npereira | Shell Programming and Scripting | 2 | 01-06-2007 01:14 PM |
| Making a SOAP call from within unix shell scripts | Laud12345 | Shell Programming and Scripting | 2 | 02-16-2005 02:23 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi ,
I am new to shell scripting I want to make script as to execute followng command mysqldump -u (user name) -p(password) database name>filename.sql this file saves with current date and time and execute automatically at particular time which I give |
|
||||
|
I made shell script but when I execute through shell command it execute successfully but when when i use crontab it execute the backup but shows 0 kb I did following step
step 1 : my shell script is #! /bin/sh USER="root" PASS="nxsmasc" DB="sme" DATE=`date +%y-%d-%m` #date=`date +%F%R` #space between date and + #longdate=`date +%m%d%y%h%mm%ss` mysqldump -u $USER -p$PASS $DB>/home/today_sme-$DATE.sql echo "done" I stored this file as /usr/bin/bck_sme.sh step 2: when i execute comand sh bck_sme.sh it excutes successfully step 3: now through crontab typed command crontab -e following entry 29 19 * 12 0-6 /usr/bin/bck_script.sh but when it execute it shows 0 k file Please tell where could be problem |
|
||||
|
as i checked mail following found
Subject: Cron <root@ninex> /usr/bin/bck_script.sh Date: Mon, 15 Dec 2008 20:01:01 0530 (IST) Content-Type: text/plain; charset=UTF-8 Auto-Submitted: auto-generated X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/root> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=root> X-Cron-Env: <USER=root> /usr/bin/bck_script.sh: line 12: mysqldump: command not found done but this execute by command sh bck_script.sh not through crontab |
|
|||||
|
You just have to fix your PATH variable. When you are the command prompt, type:
Code:
echo $PATH echo $LD_LIBRARY_PATH ALSO, you're outputting to a file in /home. That's normally INCORRECT. Your output file should be something like: Code:
... >$HOME/today_sme-$DATE.sql |
![]() |
| Bookmarks |
| Tags |
| mtime, shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|