January 15, 201313 yr I've been trying to automate the backup of my Mysql database by putting a script in cron.hourly (for testing, will move to daily when done.) So far, no luck, The script does run from the command line. #! /bin/bash #Mysql Backup /usr/bin/mysqldump -u root -proot newznab | gzip > /mnt/user/Backup/Mysql/newznab_`date +%Y%m%d`.sql.gz I did make it executable so permissions shouldn't be a problem. I suspect there may be a problem in connection with my upgrade to V5. Previously, under 4.7 I had, through Unmenu, monthly parity checks and emails concerning status. These stoped working after the upgrade. When upgrading, I added Simplefeatures and various plugins. Thinking that maybe Simplefeatures plugins were causing a problem, I disabled all but the web gui and webserver, still no luck running the cron job. I'm am still running other plugins (SABnzbd, Couch Potato, Headphones, Sickbeard, Newznab, Mysql, PS3 Media Server.) Any thoughts?
January 15, 201313 yr You could just put the below line under the regular cron (/var/spool/cron/crontabs/root) to run hourly. 0 * * * * mysqldump -u root -proot newznab | gzip > /mnt/user/Backup/Mysql/newznab_`date +%Y%m%d`.sql.gz I have a few lines that I add to my cron (runs spotweb updates & backs up my dbs). I created a file named /boot/custom/mycron that contains all my custom jobs & to make sure it is added every time I reboot, this is in my go file: # Add custom jobs to crontab cat /boot/custom/mycron >> /var/spool/cron/crontabs/root
January 16, 201313 yr Author Tried Lainie, doesn't work. I suspect one of my plugins may be the culprit, I'll try disabling one at a time and see what happens.
January 19, 201313 yr Author Turns out my PS3Media Server installation was causing a problem resulting in crond segfaults. I replaced it with Serviio, my cron job now runs. On a side note, can you script gurus suggest some modification of my previouslly posted Mysql backup script that would delete previous backups that were say 2 days old as I would at most want to keep 2 backups. Thanks.
January 19, 201313 yr On a side note, can you script gurus suggest some modification of my previouslly posted Mysql backup script that would delete previous backups that were say 2 days old as I would at most want to keep 2 backups. Thanks. Can be done with one line. Look at the manpage for the "find" command. Here is an example of what you want. find /mnt/user/Backup/Mysql/ -mtime +2 -name newznab* -type f -exec rm -rf {} \; This command will do a search in /mnt/user/Backup/Mysql/ for all files that were last modified 2 or more days ago and executes a recursive forced (-rf) remove (rm). The "{}" (curly braces) is the place holder for exec to use where it will put the name of the file, and the "\;" tells exec that's the end of the statement. Find is very powerful, and I suggest you do some reading BEFORE you do any removing using "find". Also, as a test you can replace the "rm -rf" with "ls -la" to get a list of all the files that would be removed.
Archived
This topic is now archived and is closed to further replies.