Cron Job With Multiple Databases
I have several DBs and need to run a cron job on one of the databases every night.
to run a repair/optimize on the DB as its very active, this is the command I thought I would use:
Code:
REPAIR TABLE `etc` , `etc` ,
Code:
OPTIMIZE TABLE `etc` , `etc` ,
How do I specify which database to run this on in the cron in CPanel?
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Cron Job
in order to backup db automatically i want to use cron job. So i set cron job at 00 AM suppose that : my infos db name : db db user : zode db pass : 123 the command i use is following PHP Code: mysqldump -u zode -p123 of -K -c -f --compatible=mysql40 --default-character-set=utf8 db > backup/db_`date +%d%m%y`.sql in good time i am looking into backup directory db is in it or not but there is nothing in it
View Replies!
View Related
Cron Job
I run A Centos 4.xx latest kernel server and Ive got a problem with Cron Job reporting. The Cron Jobs themselves are working fine but I keep getting this message, on the hour, every hour Quote: Originally Posted by Email from the Cron Daemon Not a directory: /etc/cron.hourly The folder etc/cron.hourly DOES EXIST! and I cannot work out what could be causing this? Does anyone hgave any ideas what could be causing it
View Replies!
View Related
CRON Job Timing Out
i have had a problem for some time now, regarding my CRON jobs. I am trying to download a large amount of data from ebay (through their API, totally legal and aboveboard) using php, but my CRONjob times out. I have tried resetting the timeout variable, but then it exceeds the maximum filesize SO, my question: is there any way to have a script run as a CRON job, and wen it is complete, call another script?
View Replies!
View Related
Reboot Cron Job
VPS isn't rebooting by itself when it goes down. Anyone has any program/script that monitors heartbeat of the server? Like when it goes down, the program will automatically reboots the system. I know there's such a script out there but I forgot what it called.
View Replies!
View Related
Cron Job Email In DA
I've got limited knowledge in scripting so I've come to the interweb for help. Google hasn't answered any of my queries so the trusty WHT is next. I'm trying to create a script cron that will email my clients once per month with space and bandwidth useage reminders. I'd prefer not to have to set up crons in each individual account, but rather email all with tokening including |name| |bandwidth| |space| out of the allowed space & bandwidth according to the clients package.
View Replies!
View Related
MySQLDUMP Cron Job
setting up a new cron job. I would like to have MySQLDUMP dump my specified database(s) into a specified folder using date and time stamps in the filename. I've done some searching on this but haven't really came up with a way to do all of this at once, or if I may need to setup a cron job to rename the file after the dump has completed. I may be going about this all wrong to begin with, I'm just looking for a very simple and reliable way to backup my databases. I'm testing this on a Shared Web Host account at this time which does have SSH shell access, but I wasn't sure if this makes a difference.
View Replies!
View Related
Backup MySQL Databases By Cron
how to backup MySQL databases by cron and have the backups sent to you by email, or have them uploaded by FTP. It is based on a script I found at another website though I can confirm it is fully working. Change the commented variables in the following file and save it as backup.sh: Code: #!/bin/sh # This script will backup one or more mySQL databases # and then optionally email them and/or FTP them # This script will create a different backup file for each database by day of the week # i.e. 1-dbname1.sql.gz for database=dbname1 on Monday (day=1) # This is a trick so that you never have more than 7 days worth of backups on your FTP server. # as the weeks rotate, the files from the same day of the prev week are overwritten. #/bin/sh /home/user/directory/scriptname.sh > /dev/null ############################################################ #===> site-specific variables - customize for your site # List all of the MySQL databases that you want to backup in here, # each seperated by a space # If not run by root, only one db per script instance databases="mydbname" # Directory where you want the backup files to be placed backupdir=/home/mydomain/backups # MySQL dump command, use the full path name here mysqldumpcmd=/usr/bin/mysqldump # MySQL Username and password userpassword=" --user=myuser --password=mypasswd" # MySQL dump options dumpoptions=" --quick --add-drop-table --add-locks --extended-insert --lock-tables" # Unix Commands gzip=/bin/gzip uuencode=/usr/bin/uuencode mail=/bin/mail # Send Backup? Would you like the backup emailed to you? # Set to "y" if you do sendbackup="n" subject="mySQL Backup" mailto="me@mydomain.com" #===> site-specific variables for FTP ftpbackup="y" ftpserver="myftpserver.com" ftpuser="myftpuser" ftppasswd="myftppasswd" # If you are keeping the backups in a subdir to your FTP root ftpdir="forums" #===> END site-specific variables - customize for your site ############################################################ # Get the Day of the Week (0-6) # This allows to save one backup for each day of the week # Just alter the date command if you want to use a timestamp DOW=`date +%w` # Create our backup directory if not already there mkdir -p ${backupdir} if [ ! -d ${backupdir} ] then echo "Not a directory: ${backupdir}" exit 1 fi # Dump all of our databases echo "Dumping MySQL Databases" for database in $databases do $mysqldumpcmd $userpassword $dumpoptions $database > ${backupdir}/${DOW}-${database}.sql done # Compress all of our backup files echo "Compressing Dump Files" for database in $databases do rm -f ${backupdir}/${DOW}-${database}.sql.gz $gzip ${backupdir}/${DOW}-${database}.sql done # Send the backups via email if [ $sendbackup = "y" ] then for database in $databases do $uuencode ${backupdir}/${DOW}-${database}.sql.gz > ${backupdir}/${database}.sql.gz.uu $mail -s "$subject : $database" $mailto < ${backupdir}/${DOW}-${database}.sql.gz.uu done fi # FTP it to the off-site server echo "FTP file to $ftpserver FTP server" if [ $ftpbackup = "y" ] then for database in $databases do echo "==> ${backupdir}/${DOW}-${database}.sql.gz" ftp -n $ftpserver <<EOF user $ftpuser $ftppasswd bin prompt cd $ftpdir lcd ${backupdir} put ${DOW}-${database}.sql.gz quit EOF done fi # And we're done ls -l ${backupdir} echo "Dump Complete!" exit Upload backup.sh to your server, to any directory you want. A directory which is not web-accessible will stop your login information being seen by just anyone . You should chmod the file to 777: Code: chmod 777 backup.sh If you uploaded this file from a Windows machine you will need to convert the file to Unix format. You should run the following command by SSH in the appropriate directory: Code: dos2unix backup.sh If you don't have dos2unix installed, you can install it using yum if you have that: Code: yum install dos2unix If you don't have yum, get it here. You may want to test the script at this point to make sure it's doing what you want it to. Change to the appropriate directory and run this command: Code: ./backup.sh Once you're happy with it, enter it into the crontab to run daily (or whenever you want). Cron jobs vary a lot depending on the configuration of your system, so check Google for how to do it on your system. The command you will need to run by cron is: Code: /path/to/file/backup.sh
View Replies!
View Related
Cron Job Deleted - Is Their A Log?
We are running cpanel on one of our servers. Several cron jobs were deleted from the cron panel of one acct. I have no idea of the paths to re-enter these jobs. Is their a log file on the server that will show cron job history from previous runs so I can recover the proper paths?
View Replies!
View Related
Cron Job And Query String
Is it possible to call a cron job with a query string appended to the file. I have no problem setting up crons in the cron tab..but i'd like the cron to fetch a url that looks something like /home/php/some-file.php?a=1 is this possible directly through the cron job? I guess an alternative is call some php file that uses curl but i was wondering if there 's a direct way.
View Replies!
View Related
Random Cron Job Command
I am running wordpress with wp O matic. I want to update my content after 24 hours (but different time each day). Bottom line is I want a cron command which randomly execute after 24 hours instead of a particular time. For example currently wp o matic shows the following command the following command, would you please advice how i change the this command to achieve the above results (right now wordpress is running on my computer so following thing is just for example) */20 * * * * F:Testlogwp-contentpluginswp-o-matic/cron.php?code=8b935355
View Replies!
View Related
Cron Job Not Working Properly
I have a slight problem with a cron job I have setup. I wanted to save a copy of iptables every hour to a folder, so I created a script... here it is: Code: varDate=`date +%y%m%d` varTime=`date +%H%M` filename="IPtablesBackup-$varDate-$varTime" iptables-save -c > /etc/IPtablesBackup/$filename and called is Backup-Script.sh Now if I just execute the script will in root ./Backup-Script.sh I get a new file with the correct filename and iptables info is saved ! Great ! So then I thought, how can I setup this automatically every hour. Which leads me on to my problem. I inputted "crontab -e" added this line Code: 59 * * * * /etc/IPtablesBackup/Backup-Script.sh The problem is the script is run, I know because it creates a new file with the correct time and date, however the file is empty? I have set Backup-Script.sh to 777 and owner and group are both root?
View Replies!
View Related
Cron Job Failure Mails
I have a server like this: WHM 10.8.0 cPanel 10.9.0-S9966 CentOS 3.8 i686 - WHM X v3.1.0 My cron files are like this: var/spool/cron/ Quote: 33 4 * * * /scripts/upcp 0 1 * * * /scripts/cpbackup */15 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1 2,58 * * * * /usr/local/bandmin/bandmin 24 5 * * * /usr/local/cpanel/whostmgr/docroot/cgi/cpaddons_report.pl --notify 0 0 * * * /usr/local/bandmin/ipaddrmap 0 */1 * * * /usr/local/nobody_check/nobody_check >/dev/null 2>&1 0 6 * * * /scripts/exim_tidydb > /dev/null 2>&1 */5 * * * * perl /root/rvadmin/rvmultiupdate.pl >/dev/null 2>&1 14 6 * * * perl /root/rvadmin/auto_rvskin.pl */5 * * * * /usr/local/cpanel/bin/dcpumon >/dev/null 2>&1 But e-mails like tha is coming to me Quote: Cron <root@mavi> /usr/local/cpanel/bin/dcpumon >/dev/null 2>&1 /bin/sh: line 1: 1 : ambiguous redirect Quote: Cron <root@mavi> perl /root/rvadmin/rvmultiupdate.pl >/dev/null 2>&1 /bin/sh: line 1: 1 : ambiguous redirect
View Replies!
View Related
Cron Job Not Working, Restart Services
I'm having a bit of trouble with one cron job that doesn't seem to work. I have others scripts that run hourly fine. However this one does not. The script: restart_monitoring.sh Code: #!/bin/bash service iptables stop service iptables start /root/bandwidth_rules.sh /root/portforward_config.sh exit The two scripts at the end just load a lot of iptables rules back in. The cron job should run hourly (59th minute) The cron job entry Code: 59 * * * * /root/restart_monitoring.sh I have restart crond to enable the new job, still doesn't run. The job is to restart iptables, thus flushing all rules that I have running, then reloading them. I have figured out the problem to be with the "service iptables stop/start" command, it doesn't seem to like doing this...?
View Replies!
View Related
Cron Job In Cpanel. Want To Automate Backups
I have been doing some research and I would love some help with this. I want to set up a cron to automatically backup my site's files & databases once a month. And I am not sure what how I do it? - Do I need a script on my server and then the cron job runs it? - Is there a better way to do this then cron?
View Replies!
View Related
Cron Job :: Run Script Every Second, Of Every Minute, Of Every Day
Say I have a script... /home/user/public_html/script.php I want to run this script every second, of every minute, of every day. How would I do this? I want to set up a cron and run it, I have written a cron and I am running it in shell as I type, but if I close shell the cron exits, can anybody assist me with making a cron run this script every second permanently.
View Replies!
View Related
Scheduled Consecutive Shell Commands Or As Cron Job
Is it possible to schedule consecutive shell commands to be run at a given time or every certain period (like every hour)? This is important for me as I want to schedule to run certain program and then input the following commands afterwards to do and complete the task, all automatically within the specified schedule. One example would be connecting to an FTP. First you'd need to input the ftp command to run the ftp program, then following that, input another commands consecutively within that session (the ftp program) to do and complete the task. I'm running KDE on CentOs4 btw. Is it even possible to do this on cron jobs?
View Replies!
View Related
Cron Job That Deletes Backup Files Older Than 5 Days
This is on a RHEL 4 Box. I want to create a cron job that deletes backup files that are older than 5 days. I have created a shell script (/usr/local/src/runjob.sh) that runs successfully from the SSH command line: Code: #pwd /usr/local/src #./runjob.sh Here is the script: Code: #!/bin/sh # # find /usr/local/apache/sites/*/BACKUPS/ -maxdepth 1 -atime +5 -iname 'test*.txt' -exec rm {} ; Script has 777 permissions and is owned by root. I have the following entry in crontab: Code: 10 12 * * * /bin/sh /usr/local/src/runjob.sh >/dev/null 2>&1 As shown in the cron log, the job does run, but it does not delete the files. And there are files older than 5 days in the directory that meet the find criteria.
View Replies!
View Related
Create A Cron Job To Clear Your /tmp Folder Automatically?
how I can create a cron job that runs every 10minutes or so to clear my /tmp folder on one of my servers? Reason I ask is, it keeps getting filled up and doesn't delete the fiels in it and stops certain scripts from running. Also, again, I need step by step instructions, such as: 1) what, where the file is I need to place the cron job in 2) what line of code would I put in that file (what does the cron job line look like for every 10min every day) 3) do I need to restart anything, and if so, what command do I run in shell?
View Replies!
View Related
HOWTO Cron Job To Copy Files From Folder To Root
how to setup a cron job to copy files & directories from one folder to the root folder. I have CPanel X. My root directory is public_html/ I have another directory public_html/uploads containing both files and directories. I need a cron job that will copy all the files & directories from public_html/uploads to the root public_html/ If it helps, here is some system info General server information: Operating system Linux Service Status Click to View Kernel version 2.6.22_hg_grsec_pax Apache version 1.3.39 (Unix) PERL version 5.8.8 Path to PERL /usr/bin/perl Path to sendmail /usr/sbin/sendmail PHP version 4.4.4 MySQL version 4.1.22-standard cPanel Build 11.17.0-STABLE 19434 Theme cPanel X v2.6.0
View Replies!
View Related
MySQL Backup Multiple Databases
My site is databases driven and runs on around 15 mySQL databases. Im wanting to download a local copy of these databases daily, however, if i try and back them up via cPanel (on a WHM VPS) they give me blank files. Each databases is around 55mb and growing. I can back them up one by one via phpmyadmin, it just takes around 5 minutes per database. Meaning around 40 minutes per night.. Is there any solution for having a script downloading them automatically so i can download them via ftp? I've tried [url].htm but it gives me blank files.
View Replies!
View Related
Cron Job - "No Input File Specified."
I'm on paid hosting and accessing the cron jobs through a control panel. I have a php script that I'd like to run daily. I've put this script in the folder http://mysite.com/Cron/ . When I navigate to this file directly in my web-browser it runs perfectly and sends me an e-mail. When I try to set up a cron tab to execute it, though I get the following error in the cron output... Quote: Status: 404 X-Powered-By: PHP/4.4.6 Content-type: text/html No input file specified. The command I entered into the control panel was... Quote: php [url] I also tried... Quote: php -q [url] ...and... Quote: php /Cron/SendMail.php ...those times getting the error... Quote: /bin/sh: [url]: No such file or directory why this might not be working for me?
View Replies!
View Related
UNLIMITED Databases
Do u want to run an online e-commerce store? create a forum? or develop the next facebook or myspace? If you answered yes to any of th questions then there are very important factors you need to consider before choosing a host. You have to understand that there's a difference between Database and database size. UNLIMITED database means that you have as many databases as you want, but of what use is an unlimited database if the disk size for the database is just 50MB for example. Don't be deceived by the number of database a web host company is willing to chun out. Do a little research, ask questions. Afterall you might not need an unlimited database afterall.
View Replies!
View Related
How Do You Backup Your Databases
So your host keeps at least a daily backup of your database, but if you don't get to the backup in time, you may find that they have a backup of a crashed database. That means its important to have a procedure for getting regular backups by other means too. How are you doing this?
View Replies!
View Related
Setting Up Databases
Does anyone know anything about how to set up a mysql database? I installed this script for a gallery for wordpress but it won't create it's own databases. I already set one up myself but Im still getting this error: Quote: SELECT * FROM wp_fim_cat ORDER BY date DESC Is there something Im supposed to add inside each database table? And how do I add it to make it work?
View Replies!
View Related
Databases Backup ? (Rsync)
I am using bqinternet.com to backup (Rsync) some accounts. I sent them a ticket before 2 days and didn't get any reply. I used this command to schedule a remote backup for specific accounts: Code: echo "30 6 * * * root rsync -avz -e ssh ~account1 ~account2 ~account3 myuser@myuser.bqbackup.comerver" >> /etc/crontab But, I found this command will backup only files. How can I backup also databases?
View Replies!
View Related
Visualizing MySQL Databases
I've recently been asked to do a lot of data extraction from a state that has about 20 databases, each with between 10 and 100 tables. I often find myself diagramming things out on paper to try to visualize how everything works together. I wondered if there's a tool that would "draw" the tables, columns, and relationships? I hesitate to say this, but almost like how MS Access does it, but that runs on Linux and does MySQL. Is there such a thing? I know about phpMyAdmin and MySQL's Query Browser, but it's not what I'm looking for.
View Replies!
View Related
MS Access Databases On Server
My question is regarding Microsoft Access Databases and ASP.NET. I know that you need SQL server installed so that your website can communicate with any sql databases in use. Do you need Microsoft Access installed on a server where you accessing a MS Access Database?
View Replies!
View Related
Is There A Way To Search Through MySQL Databases
I am running a dedicated server with Debian, and I installed a community sofware that has a lot of mySQL entries, many of which need to be changed to fit my needs However, it is very hard to know exactly where each value I need to change is stored. Is there a way to search all database tables for a specific value? For example, one thing that is stored in the database is the site's title displayed in the browser's title bar. The sofware does not give me the option to change it, so I have to find where it is located in the database and change it myself, but it would be extremely time comsuming to check all tables one by one for any occurences of the current title.
View Replies!
View Related
Are My MySQL Databases Hosed
My HD was failing. So ServerBeach quickly set me up with a fresh box with the dying drive installed as a secondary drive. (nice job guys) I'm able to mount the secondary drive and browse/copy the files... but when I get to the most important files of all, the database binaries, my /var/lib dir looks like this: Code: [root@rosemary v2]# ls -l /mnt/dying/var/lib/ total 68 ... .... -rw-r--r-- 1 root root 2171 Sep 14 03:02 logrotate.status drwxrwsr-x 6 root 41 4096 Oct 12 2005 mailman drwxr-xr-x 2 root root 4096 Oct 12 2005 misc ?--------- ? ? ? ? ? mysql drwxr-xr-x 4 root root 4096 Oct 12 2005 nfs drwxr-xr-x 2 ntp ntp 4096 Sep 14 10:31 ntp ... ... And if I try to cd into the dir, I get this: Code: [root@rosemary v2]# cd /mnt/dying/var/lib/mysql -bash: cd: /mnt/dying/var/lib/mysql: Input/output error I really *really* need this data! Am I just totally S.O.L. ?
View Replies!
View Related
|