LinHES Forums
http://forums.linhes.org/

My mythbackend babysitting script - babysit_backend.sh
http://forums.linhes.org/viewtopic.php?f=3&t=13613
Page 2 of 4

Author:  thornsoft [ Sun Jan 28, 2007 4:14 pm ]
Post subject:  Re: crontab sanity check

neutron68 wrote:
By the way, the suggested crontab commands don't work in R5E50.


Sure they do! But if you don't have a crontab, it'll be blank.
In that case, just issue:
Code:
vi crontab.txt


from "man crontab"
Code:
 The  -l  option  causes the current crontab to be displayed on standard output..


Try it - and you should see that things run, the way I said.

Author:  neutron68 [ Sun Jan 28, 2007 4:26 pm ]
Post subject:  Re: crontab sanity check

thornsoft wrote:
neutron68 wrote:
By the way, the suggested crontab commands don't work in R5E50.


Sure they do! But if you don't have a crontab, it'll be blank.

I've got a crontab file! I've got /etc/crontab and it's got text in it.
Why doesn't that text show up with the crontab -l and -e commands?

Author:  Escher0 [ Sun Jan 28, 2007 10:18 pm ]
Post subject: 

How is this script different from mbemon ( http://mysettopbox.tv/phpBB2/viewtopic.php?t=10998 )? Based on the descriptions, mbemon seems more robust and includes pretty good logging. mbemon seems to run alright on R5E50 or am I missing something? I'm just confused about the difference.

Author:  thornsoft [ Sun Jan 28, 2007 11:18 pm ]
Post subject: 

I didn't know about mbemon, it certainly seems quite comprehensive. With all the backend problems since R5E50, I'm surprised nobody mentioned it before now.

Author:  thornsoft [ Sun Jan 28, 2007 11:25 pm ]
Post subject:  Re: crontab sanity check

neutron68 wrote:
I've got a crontab file! I've got /etc/crontab and it's got text in it.
Why doesn't that text show up with the crontab -l and -e commands?


crontab -l is going to show you the crontab entries for the current userid.
i.e. "root".

/etc/crontab is the "system crontab". I've never dealt with that directly.

Author:  neutron68 [ Mon Jan 29, 2007 9:04 am ]
Post subject:  Re: crontab sanity check

thornsoft wrote:
neutron68 wrote:
I've got a crontab file! I've got /etc/crontab and it's got text in it.
Why doesn't that text show up with the crontab -l and -e commands?


crontab -l is going to show you the crontab entries for the current userid.
i.e. "root".

/etc/crontab is the "system crontab". I've never dealt with that directly.


Oh, man! So, there are multiple crontabs to keep track of??? :shock:
I'm slowly seeing the big picture take shape - one bit of information at a time. Up to now, I've been putting every cron job into the /etc/crontab file.

In my mind, this babysitting script is a good thing for the system crontab to do, since it is necessary for the system to stay functional.

Thanks for the clarifications.

Author:  tjc [ Mon Jan 29, 2007 6:54 pm ]
Post subject:  Re: crontab sanity check

thornsoft wrote:
/etc/crontab is the "system crontab". I've never dealt with that directly.

Yes, multiple crontabs. A system one and a private one for every user. One difference to be aware of is that the system one require a username in column six, and the command in column 7 and beyond, but the user ones do not allow that and the command starts in column 6.

Code:
root@black2:~# crontab -l
*/5 * * * * /usr/local/bin/rrd_all.sh
root@black2:~# more /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
root@black2:~# crontab -l
*/5 * * * * /usr/local/bin/rrd_all.sh

I've seen at least a couple people get confused and bitten by this in the last several weeks.

Author:  thornsoft [ Mon Jan 29, 2007 8:02 pm ]
Post subject:  Re: crontab sanity check

tjc wrote:
I've seen at least a couple people get confused and bitten by this in the last several weeks.

Thanks tjc,
Do you know where this thing came from? Has it been in Linux from the beginning? I used to do lots of Unix work (AIX), and never encountered this thing. Maybe it was there and I never knew it! No matter how much you think you know, there's always something.
Are there general guidelines as to when you use one vs. the other?
Along that line, should something like this job (or my babysit_commflag.sh) be run as mythtv instead of root?

Author:  tjc [ Mon Jan 29, 2007 8:21 pm ]
Post subject:  Re: crontab sanity check

thornsoft wrote:
Do you know where this thing came from? Has it been in Linux from the beginning?

I think it's been around for a long time. Maybe a Vixie cron thing? AIX is a really odd mix. It's the only Unix family OS I'm aware of where admins still regularly add stuff to /etc/inittab rather than putting a script in /etc/init.d and symlinks in the /etc/rc*.d directories.
thornsoft wrote:
Are there general guidelines as to when you use one vs. the other?

About what you'd expect. You only want really fundamental mechanism in /etc/crontab, it's there to drive other ones.
thornsoft wrote:
Along that line, should something like this job (or my babysit_commflag.sh) be run as mythtv instead of root?

Sounds like a good idea to me.

Author:  neutron68 [ Tue Jan 30, 2007 4:36 pm ]
Post subject:  followed your advice

OK, I followed your advice. I removed the script call from the /etc/crontab and put it in the root crontab as shown on page 1 of this thread (I used nano rather than vi to do my text edits, however).

Now I am Linux-compliant, right? :)

Eric

Author:  thornsoft [ Tue Jan 30, 2007 6:55 pm ]
Post subject:  Re: followed your advice

neutron68 wrote:
Now I am Linux-compliant, right? :)
Eric

Hey, I wasn't complaining about your other method. I was just unfamiliar with it. But I knew that my approach WOULD work.
Anyway, I'm glad you're operational now.

Author:  novellahub [ Fri Feb 02, 2007 6:40 am ]
Post subject: 

Thronsoft -

Thank you for posting both your "babysitting" scripts. The mythbackend went down on me yesterday during heavy recording (Utilizing both tuners of my PVR-500). This was before I installed the script. I installed both of them in the regular crontab (not system) and they are both working great. I was not having any issues with the commflag hitting on performance (I think since my Opteron is dual core) but I though it would be helpful when I start playing back HD content.

Author:  neutron68 [ Fri Feb 02, 2007 9:22 am ]
Post subject:  if empty?

Since activating the babysitter script, I have watched the file /var/log/mythtv/babysit_backend.log and it remains empty.
Does that mean that my backend has not needed restarting? I got the impression that the backend was comming disconnected for everyone with R5E50 and this log would slowly fill up with entries?

Author:  thornsoft [ Fri Feb 02, 2007 10:27 am ]
Post subject:  Re: if empty?

neutron68 wrote:
Since activating the babysitter script, I have watched the file /var/log/mythtv/babysit_backend.log and it remains empty.
Does that mean that my backend has not needed restarting? I got the impression that the backend was comming disconnected for everyone with R5E50 and this log would slowly fill up with entries?

Test it by killing the backend with Alt+2 and it should re-start within a minute.

Author:  neutron68 [ Fri Feb 02, 2007 11:30 am ]
Post subject:  it's working

thornsoft wrote:
Test it by killing the backend with Alt+2 and it should re-start within a minute.

I just killed the backend and it restarted within 1 minute. The log file now has an entry
Code:
Fri Feb  2 11:21:01 CST 2007 - Myth Backend Babysitter - restart needed
Restarting MythTV server: mythbackendNo /usr/bin/mythbackend found running; non$
.
.
Sleeping....
Myth Backend restarted as process 5116.

I can see that it is working. Now, I'm surprised that the backend hasn't been disconnecting on me, like it has with others.

Page 2 of 4 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/