View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 5 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Regular Maintenance
PostPosted: Sun Aug 24, 2014 9:02 pm 
Offline
Joined: Mon Aug 14, 2006 8:24 pm
Posts: 295
Location: Melbourne, Australia
Since I first started using Knoppmyth/LinHES I have always shutdown and used ACPI wake. Back when I was running R5.5 I developed a script (discussed here) to perform regular maintenance when the machine shutdown via mythwelcome. On successive shutdowns the script would:
1. Optimize the db
2. Perform a backup including a secondary backup to an alternate drive
3. Defragment the xfs drives
4. Maintain a copy of videos, music and gallery

I maintained and updated the script through R6 and R7 but now that I have upgraded to R8 I find it is redundant. Optimize and backup up (including secondary) are both done daily as part of myth_mtc and defrag is done as a weekly cron job. I think I will probably change task 4 to a cron job as well and do away with the shutdown script altogether.

From what I have read LinHES uses cron, not anacron or cronie and that weekly jobs are timed to execute at midnight Sunday morning. Therefore if my machine is shutdown at that time it would not run. In order to test it I added a trace to the “checkXFSdefrag.sh” script (I think that’s the name) which also logged the time and date into /var/log/xfsdefrag.log. Yesterday I looked and found that cron had executed the script at about 17:41 Saturday which roughly corresponded to when I turned the machine on manually. This is not what I was expecting but am happy it works.

Does cron have some cleverness that I don’t understand?

_________________
Intel DG965WH, Dvico DVB-T Lite x2, HDHR, Gigabyte GT220, KingstonSSD, WD20EARS R8.4.3


Top
 Profile  
 
 Post subject: Re: Regular Maintenance
PostPosted: Mon Aug 25, 2014 7:40 am 
Offline
Joined: Fri Jul 21, 2006 11:12 pm
Posts: 1033
Location: SC
nicom wrote:
Does cron have some cleverness that I don’t understand?
LinHES uses dcron which has many of the benefits of anacron, including running missed hourly, daily, monthly, etc jobs.


Top
 Profile  
 
 Post subject: Re: Regular Maintenance
PostPosted: Wed Aug 27, 2014 8:16 pm 
Offline
Joined: Mon Aug 14, 2006 8:24 pm
Posts: 295
Location: Melbourne, Australia
Thanks Britney, that explains it.

_________________
Intel DG965WH, Dvico DVB-T Lite x2, HDHR, Gigabyte GT220, KingstonSSD, WD20EARS R8.4.3


Top
 Profile  
 
 Post subject: Re: Regular Maintenance
PostPosted: Fri Sep 12, 2014 5:58 pm 
Offline
Joined: Mon Aug 14, 2006 8:24 pm
Posts: 295
Location: Melbourne, Australia
As I said in my first post I was going to convert my media backup to a cron job. If anyone is interested this is script I prepared which I keep in the mythtv home directory for upgrade reasons then copy to /etc/cron.weekly
Code:
#!/bin/bash
#
# mediabackup.sh
#
# This script copies videos, music and gallery to the secondary disk
# It is run as a weekly cron job
#
# Copy this file to /etc/cron.weekly maintaining root:root ownership
#     sudo cp /home/mythtv/mediabackup/mediabackup.sh /etc/cron.weekly
#
BACKUPDIR=/data/storage/disk1/backup/user_backups/media-backup

   echo `date` > /home/mythtv/mediabackup/mediabackup.log
   echo `rsync -vrt --delete /myth/video $BACKUPDIR` >> /home/mythtv/mediabackup/mediabackup.log
   echo `rsync -vrt --delete /myth/music $BACKUPDIR` >> /home/mythtv/mediabackup/mediabackup.log
   echo `rsync -vrt --delete /myth/gallery $BACKUPDIR` >> /home/mythtv/mediabackup/mediabackup.log
   echo `date` : Completed media backup >> /home/mythtv/mediabackup/mediabackup.log

Alice, I think you may have posted in the wrong thread.

_________________
Intel DG965WH, Dvico DVB-T Lite x2, HDHR, Gigabyte GT220, KingstonSSD, WD20EARS R8.4.3


Top
 Profile  
 
 Post subject: Re: Regular Maintenance
PostPosted: Sat Sep 13, 2014 4:45 pm 
Offline
Joined: Mon Aug 14, 2006 8:24 pm
Posts: 295
Location: Melbourne, Australia
Looking at the logs for the regular defraging script (/var/log/xfs_defrag.log) I noticed that /dev/sda7 was tested twice
Code:
/dev/sda7   0 is not above fragmentation threshold of 15.
/dev/sda7   0 is not above fragmentation threshold of 15.
/dev/sdb3   3 is not above fragmentation threshold of 15.
I worked out the reason for this is that the script uses df to detect the xfs partitions and df outputs all mounting points so /dev/sda7 gets a mention as /data/storage/disk0 as well as /data/storage/full-name-of-disk.
Would it not be neater to use blkid to identify the xfs partitions? As a test I have modified the /usr/LH/bin/checkXFSfrag.sh as follows
Code:
array=`blkid|grep xfs|cut -f 1 --delim=":"`     #added line - change to avoid multiple listing of /dev/sda7 14sep14
#array=`df -T|grep xfs|cut -f 1 --delim=" "`     # Array of all XFS file systems. (original line)
Running this from the command line works well. Note that the delimiter had to be changed from a space to a colon to suit the output of blkid. I will let cron run it for a while and see how it goes.

_________________
Intel DG965WH, Dvico DVB-T Lite x2, HDHR, Gigabyte GT220, KingstonSSD, WD20EARS R8.4.3


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu