Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Cron Job Help

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Cron Job Help

#1 Post by Soapm »

Can someone please help me write a Cron job to run on my Tivo?

About every 3rd day around 6am I'd cron to run;

Code: Select all

dbgc-mcp -fg-index
But not until this command has finished;

Code: Select all

dbgc-mcp -fg-gc
So I need them to run in this order;

Code: Select all

dbgc-mcp -fg-gc
dbgc-mcp -fg-index
Please and thanks, I'm not having any luck trying to figure this out.
Last edited by Soapm on 2023-05-14 03:16, edited 2 times in total.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 12 times
Been thanked: 66 times

Re: Cron Job

#2 Post by dilberts_left_nut »

What's not working?
I'd probably write a small script to call them in series, then call the script from cron.
AdrianTM wrote:There's no hacker in my grandma...

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Cron Job

#3 Post by Soapm »

The guide database keeps messing up and won't accept new data so these commands fixes the database. So instead of my having to run them manually I would like to have them periodically run themselves.

Script makes sense, would this be something a novice can teach themself to do?

CwF
Global Moderator
Global Moderator
Posts: 2636
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Cron Job

#4 Post by CwF »

Code: Select all

0 6 * * 0,3 dbgc-mcp -fg-gc && dbgc-mcp -fg-index
might work

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Cron Job

#5 Post by Soapm »

Cool, thanks...

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Resolved: Cron Job

#6 Post by Soapm »

Turns out, these commands need to run as root after first mounting the drive RW. How does this look?

Code: Select all

# Re-index Guide Database
0 9 * * 0,1,2,4 root /bin/mount -o remount,rw / && root /tvbin/dbgc-mcp -fg-gc && root /tvbin/dbgc-mcp -fg-index && root /bin/mount -o remount,ro /; echo "`date` Guide Indexing Complete" >> /var/log/cronlog-main

Also, anyway to test this command to see if it's working? I see the entry "Guide Indexing Complete" in my cron log but have no clue if they effectively run. Example, all this time I didn't realize the drive has to first be mounted RW so I assumed they were working ok.

CwF
Global Moderator
Global Moderator
Posts: 2636
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Cron Job Help

#7 Post by CwF »

Soapm wrote: 2023-05-14 03:16 Also, anyway to test this command to see if it's working?
If you have a functioning mta, or mail transport agent, and the alias for user to get the cron result mail, then /var/mail/user will contain the results of every cron job.

I use sylpheed to see that mail.

Code: Select all

From: root@domain (Cron Daemon)
To: user@domain
Subject: Cron <user@domain> weather
Date: Tue, 04 Apr 2023 22:05:02 -0600

Current conditions nice
Subject is the command
Body is the command result

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Cron Job Help

#8 Post by Soapm »

CwF wrote: 2023-05-14 04:27
Soapm wrote: 2023-05-14 03:16 Also, anyway to test this command to see if it's working?
If you have a functioning mta, or mail transport agent, and the alias for user to get the cron result mail, then /var/mail/user will contain the results of every cron job.

I use sylpheed to see that mail.

Code: Select all

From: root@domain (Cron Daemon)
To: user@domain
Subject: Cron <user@domain> weather
Date: Tue, 04 Apr 2023 22:05:02 -0600

Current conditions nice
Subject is the command
Body is the command result
Thanks, I didn't have that set up but I think I bot the mail thing working for me now. I will wait to see what I get.

Post Reply