View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 37 posts ] 
Go to page Previous  1, 2, 3

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject:
PostPosted: Mon May 05, 2008 6:13 pm 
Offline
Joined: Mon Aug 14, 2006 8:24 pm
Posts: 320
Location: Melbourne, Australia
I think I see the problem. My current Command to Shutdown as defined in Mythwelcome --setup is "/sbin/shutdown -h now". What you are saying is I should replace this with a script which tests the mount count and then performs /sbin/shutdown with -r or -h depending on the outcome. Is that correct?

_________________
Intel DG965WH, Dvico DVB-T Lite x2, HDHR, Gigabyte GT220, KingstonSSD, WD20EARS version=latest


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 2:36 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
Correct. Note that you also need to set MythShutdownWakeupTime before a reboot to ensure the box shutdown down again (thanks to heilig for this finding).

BTW: I have managed to get this all working using daily wakeups. It worked flawlessly this morning. I have updated my script on page one of this thread. Similar code can be used at shutdown to cause a reboot/fsck/shutdown.

Allen

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 11, 2008 12:51 am 
Offline
Joined: Mon Aug 14, 2006 8:24 pm
Posts: 320
Location: Melbourne, Australia
I have finally had a chance to do some more experimentation with trying to get a fsck bootup triggered on shutdown. First I tried changing my setwakeup.sh so that rather than reboot I set /proc/acpi/alarm to wakeup 2 minutes later with
Code:
echo "+0000-00-00 00:02:00">/proc/acpi/alarm
and then go through the normal shutdown sequence. This should then eliminate any problem about when the mount count test is done. This works but with the same result as my previous attempt, that is it reboots to the Mythtv menu, not Mythwelcome.

My next experiment was to uncheck the option to start Mythtv if not woken for recording. Predictably this caused the box to wake up in Mythwelcome but with no countdown to automatic shutdown.

From this I have concluded the problem is that after either the reboot or my delayed wakeup, Mythwelcome determines that it was not woken for recording and immediately starts Mythtv (if the option is checked). Therefore to get it to start Mythwelcome and then shutdown on idle, it has to think it is recording. Is it possible to trick it that way?

If not then I guess it means doing by a cron job as suggested by alien or live with the box remaining on after the fsck boot.

_________________
Intel DG965WH, Dvico DVB-T Lite x2, HDHR, Gigabyte GT220, KingstonSSD, WD20EARS version=latest


Top
 Profile  
 
 Post subject: thanks and idea for acpi
PostPosted: Tue Aug 19, 2008 10:45 am 
Offline
Joined: Sun Sep 02, 2007 2:30 pm
Posts: 94
Thanks for this, especially to marc.aronson and tjc for the scripting advice. I've used this for my wake on lan automatic wakeup here: http://knoppmyth.net/phpBB2/viewtopic.php?t=18673

I reckon the script I've put together for this application can be easily adapted for your ACPI needs by simply removing the scp line and changing the location where the variable tw (containing the epoch wakeup time is written to). Although there would need to be some conversion from epoch time to 'human' time for the BIOS I guess! You would then call this script with the switch --settime %time_t (I think) in the mythtv-setup.

Hope this helps!
-Mythman

_________________
Running Knoppmyth R5.5 on a Compaq EVO D510 (sff) w/ P4 1.8GHz, 1GB RAM, 330GB 7200rpm Maxtor IDE HDD, XFX Nvidia GeForce 6200 (AGP low profile, p/n: PV-T44A-WANG) and Huappauge NOVA-T 500 DVB-T dual tuner PCI card.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 15, 2010 7:09 pm 
Offline
Joined: Sun Sep 04, 2005 7:48 pm
Posts: 264
Location: Perth, Australia
Its been a while, wondering if anyone had made any inroads to this?

I was thinking that on the setwakeup.sh, i could do the following if there was a disk check on next boot
1) create a dummy file (/var/log/mythtv/diskcheck)
2) issue a reboot instead of a shutdown
3) alter the startup script to check for the /var/log/mythtv/diskcheck
a) if present call call setwakeup.sh, and shutdown
b) if not present, start mythwelcome

would this type of approach work?

as mythwelcome nortmally calls the setwakeup.sh with a time parameter, i'd have to figure out what the next show scheduled is.... but I can probably get that from a call to mythshutdown?

Thoughts?

Nathan

_________________
LinHES: R6 | MB: Asus M3N-H/HDMI | CPU: AMD ??Mhz
Capture: 2xHDHR DVB-T
Graphics: Onboard 8300|PSU: Corsair vx450w
Cooling: Zalman cu?,
Display: Benq xx projector


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 15, 2010 7:51 pm 
Offline
Joined: Mon Aug 14, 2006 8:24 pm
Posts: 320
Location: Melbourne, Australia
I did not get any further. In fact since then I have changed the file system of the /myth partition to xfs so it does not require fsck. It does however require regular defragmentation which is another annoyance.

_________________
Intel DG965WH, Dvico DVB-T Lite x2, HDHR, Gigabyte GT220, KingstonSSD, WD20EARS version=latest


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 16, 2010 2:36 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
This is my working script to do a fsck once a month. I run it from a cron job in the mythwelcome daily wakeup period. Note that sda1 is my backup disk which is not mounted so I can fsck it directly. sdb1/3 will be checked during the reboot. I also set the maximum mounts to 200 on all drives so that they don't fsck during the month.

I have also configured my system so /usr/bin/mail works. If you want notification, you will have to change the mail lines accordingly.

Code:
#!/usr/bin/perl

$day=`date '+%d'`;
chomp($day);
if($day eq "10") {
        $error=system("/sbin/fsck -p /dev/sda1 > /tmp/fsck.out 2>&1");
        if($error) {
                system("cat /tmp/fsck.out | /usr/bin/mail -s sda1_check mythtv");
        }
        system("date > /tmp/tune2fs.out");
        system("/sbin/tune2fs -l /dev/sdb1 | grep Mount >> /tmp/tune2fs.out");
        system("/sbin/tune2fs -l /dev/sdb3 | grep Mount >> /tmp/tune2fs.out");
        system("/sbin/tune2fs -l /dev/sda1 | grep Mount >> /tmp/tune2fs.out");
        system("cat /tmp/tune2fs.out | /usr/bin/mail -s MountCount mythtv");
        system("/sbin/tune2fs -C 250 /dev/sdb1");
        system("/sbin/tune2fs -C 250 /dev/sdb3");
        system("/sbin/tune2fs -C 0 /dev/sda1");
        $wakeup=`date '+%Y-%m-%dT%H:%M:%S' -d '+ 15 minutes'`;
        system("/usr/bin/mysql -u root mythconverg -e \"update settings set data='$wakeup' where value='MythShutdownWakeupTime'\"");
        system("/sbin/reboot");
        exit;
}

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 37 posts ] 
Go to page Previous  1, 2, 3



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 24 guests


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