Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 36

Thread: 12.04 64-bit, "prettynames" cron job stopped running - need help

  1. #11
    Join Date
    Oct 2007
    Location
    Minneapolis, MN
    Beans
    217
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    The Mythlink documentation says:
    Using as a User Job

    When used as a User Job, mythlink.pl will be executed when the recording ends, and can be configured such that it only creates a link for the new recording. To use the script as a User Job, specify the --chanid and --starttime arguments in addition to any other desired arguments and it will create a link only for the new recording:

    mythlink.pl --link /mnt/pretty --chanid %CHANID% --starttime %STARTTIME% --format '%T/%T%-%S'

    Note: You will also need to run mythlink.pl separately to remove old symlinks. See Usage.
    I interpret this to mean that I need to get the cron job running, in any case, so that mythlink.pl will run at least once a day to clean up any deleted symlinks.
    Is that how you read it?

    If so, I need to get back to the cron troubleshooting!

    I found this page:
    http://www.unixgeeks.org/security/ne...ix/cron-1.html

    I just tried "ps aux | grep cron" and got this:
    Code:
    user1@Mythbuntu:~$ ps aux | grep cron
    root      1175  0.0  0.0  19104   496 ?        Ss   Aug26   0:00 cron
    user1     25280  0.0  0.0   6500   620 pts/1    S+   18:43   0:00 grep --color=auto cron
    That unixgeeks page says the top line shows that crond is running, and the bottom line is the search I just ran.

    In looking in the most rescent syslog file, I see these entries every hour:
    Code:
    Aug 31 08:12:01 Mythbuntu CRON[23079]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    Aug 31 08:12:01 Mythbuntu CRON[23078]: (CRON) info (No MTA installed, discarding output)
    I'm not sure if that is significant...
    Last edited by neutron68; September 1st, 2012 at 05:46 PM. Reason: added details

  2. #12
    Join Date
    Mar 2007
    Location
    Christchurch, NZ
    Beans
    3,239

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    Quote Originally Posted by neutron68 View Post
    The Mythlink documentation says:

    I interpret this to mean that I need to get the cron job running, in any case, so that mythlink.pl will run at least once a day to clean up any deleted symlinks.
    Is that how you read it?

    If so, I need to get back to the cron troubleshooting!
    yeah true, but at least you might get some links created!

    I just tried "ps aux | grep cron" and got this:
    Code:
    user1@Mythbuntu:~$ ps aux | grep cron
    root      1175  0.0  0.0  19104   496 ?        Ss   Aug26   0:00 cron
    user1     25280  0.0  0.0   6500   620 pts/1    S+   18:43   0:00 grep --color=auto cron
    I think this means that the cron process is running now, and that it first started up on Aug.26?

    In looking in the most rescent syslog file, I see these entries every hour:
    Code:
    Aug 31 08:12:01 Mythbuntu CRON[23079]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
    Aug 31 08:12:01 Mythbuntu CRON[23078]: (CRON) info (No MTA installed, discarding output)
    I'm not sure if that indicates CRON is failing every hour?

    Eric
    No I don't think it means it is failing. cron usually email it's results to the user specified in the cron file, but you have no MTA so that bit fails. It doesn't mean your prettyscript failed.


    However you do now know exactly what cron is running. Try
    Code:
    sudo su
    cd /
    run-parts --report /etc/cron.hourly
    and see if it works.

  3. #13
    Join Date
    Oct 2007
    Location
    Minneapolis, MN
    Beans
    217
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    No, running as root fails:
    Code:
    root@Mythbuntu:/var/lib/mythtv/pretty# cd /
    root@Mythbuntu:/# run-parts --report /etc/cron.hourly
    /etc/cron.hourly/prettynames:
    DBI connect('database=mythconverg:host=localhost;port=3306','mythtv',...) failed: Access denied for user 'mythtv'@'localhost' (using password: YES) at /usr/share/perl5/MythTV.pm line 351
    Cannot connect to database:
    
    run-parts: /etc/cron.hourly/prettynames exited with return code 255
    If I su back to a regular user, then the prettynames script runs fine!
    Code:
    su user1
    cd /
    run-parts --report /etc/cron.hourly
    I just read this thread http://ubuntuforums.org/showthread.php?t=2032983
    They say that they had to run the cron job as a regular user and NOT as root.

    So, I just changed the prettynames script to call mythlink.pl as the mythtv user:
    Code:
    #!/bin/bash
    su mythtv -c /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose  --format "%T - %S - %Y-%m-%d, %g-%i %A"
    Nope, it didn't work.

    Another thought...My prettynames script starts with
    Code:
    #!/bin/bash
    Should it start with
    Code:
    #!/bin/sh


    Eric
    Last edited by neutron68; September 1st, 2012 at 06:27 PM. Reason: update

  4. #14
    Join Date
    Oct 2007
    Location
    Minneapolis, MN
    Beans
    217
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    To test and see if the prettynames script is running I put 2 touch commands in the script.

    Code:
    #!/bin/sh
    touch /var/log/cron/before-mythlink-line 
    /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose --format "%T - %S - %Y-%m-%d, %g-%i %A"
    touch /var/log/cron/after-mythlink-line
    Code:
    user1@Mythbuntu:/var/log/cron$ ls -l
    total 0
    -rw-r--r-- 1 root root 0 Sep  1 15:12 after-mythlink-line
    -rw-r--r-- 1 root root 0 Sep  1 15:12 before-mythlink-line
    You can see that both of the touch lines get executed, so now we know that the scirpt is running, and that the mythlink line is not executing.

  5. #15
    Join Date
    Mar 2007
    Location
    Christchurch, NZ
    Beans
    3,239

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    Quote Originally Posted by neutron68 View Post
    No, running as root fails:
    Code:
    root@Mythbuntu:/var/lib/mythtv/pretty# cd /
    root@Mythbuntu:/# run-parts --report /etc/cron.hourly
    /etc/cron.hourly/prettynames:
    DBI connect('database=mythconverg:host=localhost;port=3306','mythtv',...) failed: Access denied for user 'mythtv'@'localhost' (using password: YES) at /usr/share/perl5/MythTV.pm line 351
    Cannot connect to database:
    
    run-parts: /etc/cron.hourly/prettynames exited with return code 255
    Well there is your answer. If you want it to run as root, copy your mysql.txt to /root/.mythtv/

    If I su back to a regular user, then the prettynames script runs fine!
    Code:
    su user1
    cd /
    run-parts --report /etc/cron.hourly
    I just read this thread http://ubuntuforums.org/showthread.php?t=2032983
    They say that they had to run the cron job as a regular user and NOT as root.
    that is probably the better option, the less that runs as root the better

    So, I just changed the prettynames script to call mythlink.pl as the mythtv user:
    Code:
    #!/bin/bash
    su mythtv -c /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose  --format "%T - %S - %Y-%m-%d, %g-%i %A"
    Nope, it didn't work.

    Another thought...My prettynames script starts with
    Code:
    #!/bin/bash
    Should it start with
    Code:
    #!/bin/sh


    Eric
    shouldn't matter.

  6. #16
    Join Date
    Oct 2007
    Location
    Minneapolis, MN
    Beans
    217
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    Any idea how I successfully call the mythlink.pl script as the mythtv user, from inside the prettynames script.

    I tried it a day or 2 ago and it didn't work. What did I do wrong?

    Eric

  7. #17
    Join Date
    Mar 2007
    Location
    Christchurch, NZ
    Beans
    3,239

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    Quote Originally Posted by neutron68 View Post
    Any idea how I successfully call the mythlink.pl script as the mythtv user, from inside the prettynames script.

    I tried it a day or 2 ago and it didn't work. What did I do wrong?

    Eric
    run it in your users crontab rather than in cron.hourly.

    Code:
    crontab -e
    or do what you are doing but use

    Code:
    su -
    the - provides the user's environment, including their $HOME variable so the script will use the settings im the right user's ~/.mythtv/mysql.txt

  8. #18
    Join Date
    Oct 2007
    Location
    Minneapolis, MN
    Beans
    217
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    Quote Originally Posted by nickrout View Post
    run it in your users crontab rather than in cron.hourly.

    Code:
    crontab -e
    or do what you are doing but use

    Code:
    su -
    the - provides the user's environment, including their $HOME variable so the script will use the settings im the right user's ~/.mythtv/mysql.txt
    So the line in my prettynames script would be:
    Code:
    su - user1 /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose --format "%T - %S - %Y-%m-%d, %g-%i %A"


    Eric

  9. #19
    Join Date
    Mar 2007
    Location
    Christchurch, NZ
    Beans
    3,239

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    Quote Originally Posted by neutron68 View Post
    So the line in my prettynames script would be:
    Code:
    su - user1 /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose --format "%T - %S - %Y-%m-%d, %g-%i %A"


    Eric
    Actually su - mythtv would do it too.

    I assume you mean the user which runs mythfrontend when you say "user1"

  10. #20
    Join Date
    Oct 2007
    Location
    Minneapolis, MN
    Beans
    217
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 64-bit, "prettynames" cron job stopped running - need help

    Quote Originally Posted by nickrout View Post
    I assume you mean the user which runs mythfrontend when you say "user1"
    Correct - the system owner's username.

    I have tried both of these variations, and the script still doesn't run.
    Code:
    #!/bin/sh
    touch /var/log/cron/before-mythlink-line
    su - user1 /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose --format "%T - %S - %Y-%m-%d, %g-%i %A"
    touch /var/log/cron/after-mythlink-line
    Code:
    #!/bin/sh
    touch /var/log/cron/before-mythlink-line
    su - mythtv /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose --format "%T - %S - %Y-%m-%d, %g-%i %A"
    touch /var/log/cron/after-mythlink-line
    I just tried this from a command prompt and it didn't work - looks like a syntax error with the su command?
    Code:
    user1@Mythbuntu:/var/log/cron$ su - mythtv /usr/bin/mythlink.pl --link /var/lib/mythtv/pretty --verbose --format "%T - %S - %Y-%m-%d, %g-%i %A"
    su: unrecognized option '--link'
    Usage: su [options] [LOGIN]
    
    Options:
      -c, --command COMMAND         pass COMMAND to the invoked shell
      -h, --help                    display this help message and exit
      -, -l, --login                make the shell a login shell
      -m, -p,
      --preserve-environment        do not reset environment variables, and
                                    keep the same shell
      -s, --shell SHELL             use SHELL instead of the default in passwd

Page 2 of 4 FirstFirst 1234 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •