editing crontab help

 
Thread Tools Search this Thread
Operating Systems Linux Fedora editing crontab help
# 1  
Old 08-30-2010
editing crontab help

I'm using fedora 5 and sql 5.0. I'm trying to edit the crontab to perform automatic backups of my database. For some reason it isn't working. Here is what I have so far.

15 2 * * * /usr/bin/mysqldump -opt -all-databases u root -ppassword -h localhost /home/ruth/backup/alldb_`date`+%m-%d-%Y``.sql


Can anyone explain to me why this isn't working. I've looked in the crontab logs but it doesn't show anything.
# 2  
Old 08-30-2010
Use single quotes around the date format instead of back ticks:
Code:
15 2 * * * /usr/bin/mysqldump -opt -all-databases u root -ppassword -h localhost /home/ruth/backup/alldb_`date '+%m-%d-%Y'`.sql

# 3  
Old 08-31-2010
In addition to the type of quotes, the "%" character is special to cron (it means "newline"). All the "%" characters need quoting as "\%".

You will be better putting long commands into a script file and executing that from cron. This also gives you somewhere to set the environment for your commands.
# 4  
Old 08-31-2010
how to do scripts working with cron

Can you point me to a good reference that describes how to get scripts to work with cron. I haven't found one that works yet. I know you make a file usin vi editor but getting cron to execute it well thats a bit tricky.
# 5  
Old 08-31-2010
Quote:
Originally Posted by randerson21
Can you point me to a good reference that describes how to get scripts to work with cron. I haven't found one that works yet. I know you make a file usin vi editor but getting cron to execute it well thats a bit tricky.
Hello randerson21.

This below link is a par-for-the-course response Smilie

https://www.unix.com/answers-frequent...n-crontab.html

If you have specific issues that are not addressed in the link, or any of the other information to which it refers, please post them here.

Regards.
# 6  
Old 09-01-2010
cronttab -e help

I'm still trying to get the auto backup to work. I'm in the shell prompt and I've typed

crontab -e 11 05 * * * mysqldump -u ruth -ppassword -h localhost world > /home/ruth/backup/world_try

Unix keeps complaining out the options for password. It says invalid option --p usage error unrecognized option. What do I do about this? I tired the above options with crontab -e and it would also complain about the date. I like the idea of putting a date in my file name but can't get it to work so I've simplified it a little. Please help everthing I read and try does not work.
# 7  
Old 09-01-2010
mysqldump -u sadmin -p pass21 Customers > custback.sql

why u dont put this in bash script and run it with debug option ( bash -x script.sh )?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 Replies

2. Solaris

Crontab editing issue

Hi, OS - SunOS I gave crontab -e then it returns zero. $ crontab -e 0 ? ? Crontab status - $ ps -ef | grep cron root 2481 1 0 May 12 ? 0:18 /usr/sbin/cron Please help (9 Replies)
Discussion started by: nag_sathi
9 Replies

3. Shell Programming and Scripting

Need help regarding String editing

Hi Geeks I am working on trimming the logs and extracting the XMLs from it. I am facing one problem here. My XML String is ending with ...........Request></Body></Envelope>S/R sometimes there is more then just S/R in the end. I want to delete anything comes after </Envelope>... (3 Replies)
Discussion started by: santy00110011
3 Replies

4. Shell Programming and Scripting

Need help in editing a file

I have a file which has 10 million records in it. When am trying to edit the file with vi, the following error occurs: ~ ~ ~ ~ ~ ~ ~ ~ "file1" Value too large for defined data type Is there any way that I can edit this file without using vi? Any help would be really appreciated.... (8 Replies)
Discussion started by: bobby1015
8 Replies

5. Shell Programming and Scripting

Editing crontab via ksh

Hi all, I am trying the following I am hoping that the crontab would be changed. but it prints the previous crontab and says Can anyone tell me the correct ksh command that should be used here? I don't want to edit the crontab with crontab -e, I need to edit it via ksh. Thank... (2 Replies)
Discussion started by: ajaba
2 Replies

6. UNIX for Dummies Questions & Answers

Editing crontab of non-root user from file

Hi All, Ref: "build crontab from a text file" in same forum. (I am not allowed to post URL's in the first post) We are reorganizing our UNIX Crontab file by first making changes in a word pad text file. The intent is to then copy it back to Crontab. Will this work? Copy and Paste does not... (6 Replies)
Discussion started by: nivedhitha
6 Replies

7. UNIX for Dummies Questions & Answers

Editing a cron file with crontab

I want to set up a file with crontab to run the cron deamon so I can use at to schedule jobs. I think the crontab file (or whatever you call it) has to be set up. Currently, I don't have a crontab file (I checked by typing sudo crontab -u myusername -l), and I don't know the syntax for creating... (6 Replies)
Discussion started by: Ultrix
6 Replies

8. Solaris

editing crontab with vim and using .vimrc

Hi since we migrated from Solaris 8 to Solaris 10 I do miss a nice feature when editing crontab with vim editor: no more color highlighting after starting to edit. Well there is a hack, see below. I did define: export EDITOR='vim -c ":source /export/home/duc904/.vimrc"' Under Sol8 when... (2 Replies)
Discussion started by: duc904
2 Replies

9. Shell Programming and Scripting

need help in file editing:-

I have 2 files:- file1 and file2 file1 SEED RPTT TST8 file2 SEED:db1:Y RPTT:db2:Y SED8:db2:N TST8:db:Y TRN8:db:N CNV8:db:Y TEST:db:Y I have to change third field of file2 to "y" for every entry in file1 matches first filed of file 2 and rest to N (2 Replies)
Discussion started by: okreporthai
2 Replies

10. Shell Programming and Scripting

Editing Crontab

Hi I am not able to edit crontab. Following is the comand that is being issued $crontab -e 2764 ............ This is what I am able to see But when I do $crontab -l List of all the crontab entry is displayed. Also I am seeing one entry in my /etc/cron.d prw------- 1 root ... (6 Replies)
Discussion started by: pankajkrmishra
6 Replies
Login or Register to Ask a Question