Announcement

Collapse
No announcement yet.

Script for recording radio partially working with cron

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Script for recording radio partially working with cron

    Hi all, I'm having an issue with Kcron:

    I can run a script manualy but It won't properly work when launched from Cron

    The script should create a pipe into /tmp/ to transcode an mms radio stream and save the resulting mp3 to a specified folder (if used with cron, you can make your own "podcasts" since it renames the files adding the date.

    The script is placed here:

    http://www.pplux.com/index.php?s=radio&sbutt=Go

    If launched manualy ...

    - An mms stream begins to be  captured; mplayer, mencoder, mimms, gogo and lame are nedded (I believe)
    - /tmp/radio_pipe is created
    -/home/folder_you_want/file.mp3 is created
    -/tmp/radio_pipe/ is removed


    But when the script is launched by Cron...

    - An mms stream begins to be  captured
    - /tmp/radio_pipe is created
    - BUT NO MP3 IN CUSTOM FOLDER IS CREATED
    - /tmp/radio_pipe/ is removed

    Why can't I have the script properly working when launched fron cron?, It can't write the mp3 file to custom folder, created in /home/..../folder (with writing permisions)

    I have given writting permisions (to anyone) to the folder that is supoused to hold the mp3.

    I've made the script "executable"

    AND, I ofcourse save my changes in Kcron in order to apply them.

    As far as I know there is no need to restart Cron since it look for changes every minute (or that is said in my log), ANYWAY It didn't either work after rebooting.

    Any help would be appreciate



    #2
    Re: Script for recording radio partially working with cron

    I'm a bit closer to the solution but don't know how much:

    The fact is that the script now works if I restarted cron from kcontrol
    but if I do the same in command line it does't

    "sudo /etc/init.d/cron restart"  restarts cron but doesn't still allow the script to work...

    How may I restart cron (automaticly) after kde is running? I supouse that I need to do it as root (not with sudo)...

    Any Ideas?

    may I iclude any line in the script to restart cron before it starts to record...?

    Comment


      #3
      Re: Script for recording radio partially working with cron

      Checking if cron is up and running:

      System > KSysguard (or press <CTRL><ESC>)

      The KSysguard Handbook (http://docs.kde.org/development/en/kdebase/ksysguard/)
      KSysguard is the KDE Task Manager and Performance Monitor.
      or

      System Settings > System Services
      Here System Services tell that:
      cron: Start at Boot=Yes, Status=running


      Getting info about cron started prosesses (error messages - if you are lucky, kubuntu tells why NO MP3 IN CUSTOM FOLDER IS CREATED)

      Example (in the konsole):
      Code:
       :~$ mail
      Mail version 8.1.2 01/15/2001. Type ? for help.
      "/var/mail/rog131": 4 messages 4 new
      >N 1 [email]root@localhost.lo[/email] Tue Dec 5 19:48  58/2578 Anacron job 'cron.daily' on
       N 2 [email]root@localhost.lo[/email] Tue Dec 5 20:00  18/727  Cron <root@Ammu2500L> /usr/
       N 3 [email]root@localhost.lo[/email] Tue Dec 5 23:58  18/729  Cron <root@Ammu2500L> /usr/
       N 4 [email]root@localhost.lo[/email] Wed Dec 6 10:10  60/2670 Anacron job 'cron.daily' on
      & 2
      Message 2:
      From [email]root@localhost.loca[/email]ldomain Tue Dec 5 20:00:00 2006
      X-Original-To: root
      From: [email]root@localhost.loca[/email]ldomain (Cron Daemon)
      To: [email]root@localhost.loca[/email]ldomain
      Subject: Cron <root@Ammu2500L> /usr/sbin/ntpdate ntp.ubuntulinux.org
      X-Cron-Env: <SHELL=/bin/sh>
      X-Cron-Env: <HOME=/root>
      X-Cron-Env: <PATH=/usr/bin:/bin>
      X-Cron-Env: <LOGNAME=root>
      Date: Tue, 5 Dec 2006 20:00:00 +0200 (EET)
      
       5 Dec 20:00:00 ntpdate[6137]: step time server 82.211.81.145 offset -7.837325 sec
      & q
      Note:
      This kcron example is from: Time is accelerating in KDE (http://kubuntuforums.net/forums/index.php?topic=8116.0)


      Hmm - are you using normal kcron or root cron ?

      System > Kcron

      or

      Alt + F2 > kdesu kcron > Choose root > Choose tasks > Right click tasks > Choose New (or press Ctrl + N) > Edit Task - KCron pops up
      Before you edit, BACKUP !

      Why there are dead links ?
      1. Thread: Please explain how to access old kubuntu forum posts
      2. Thread: Lost Information

      Comment


        #4
        Re: Script for recording radio partially working with cron

        Originally posted by Rog131
        Checking if cron is up and running.......

        Getting info about cron started prosesses (error messages - if you are lucky, kubuntu tells why NO MP3 IN CUSTOM FOLDER IS CREATED)......

        Hmm - are you using normal kcron or root cron ?
        - Yes, cron is up, running and it starts automaticly at booting...

        - No errors are shown in the system log, no luck

        -When opening Kcron from console I get an error message, I don't know exactly what does it mean, BUT Konsole reports the same error when I open Kcron, Kmail, KNotes... or any app wich name started with a "K" , But this don't make any of the apps to stop working (they all works great)...

        This is the error message(s):
        laptop:~$ kcron
        X Error: BadDevice, invalid or uninitialized input device 169
        Major opcode: 147
        Minor opcode: 3
        Resource id: 0x0
        Failed to open device
        X Error: BadDevice, invalid or uninitialized input device 169
        Major opcode: 147
        Minor opcode: 3
        Resource id: 0x0
        Failed to open device


        - I'm using normal Kcron (System > Kcron), Actually, Kcron crashes with SIGSEGV if I started with sudo (it crashes when trying to open a new task)

        What I can't still understand is why the script works when restarted from Kcontrol...

        Anyway, than you for your help! I'll keep trying to have it working and I'll report.





        Comment


          #5
          Re: Script for recording radio partially working with cron

          No errors are shown in the system log
          Well - in my system kubuntu is mailing notifications (cron/anacron) what is starting, what it is doing, results... They are't in the system log !

          man mail:
          mail, mailx, Mail - send and receive mail

          X Error: BadDevice, invalid or uninitialized input device 169
          Maybe this helps:
          Thread: X Error: BadDevice, invalid or uninitialized input device 168 (http://ubuntuforums.org/showpost.php?p=1264009)


          Kcron crashes with SIGSEGV if I started with sudo
          This (RootSudo - https://help.ubuntu.com/community/RootSudo) says:
          NEVER use sudo to start graphical programs. You should always use gksudo or kdesu to run such programs, otherwise new login attempts may fail.
          I think: graphical programs = kde programs. If you use kdesu -> less crap.


          Before you edit, BACKUP !

          Why there are dead links ?
          1. Thread: Please explain how to access old kubuntu forum posts
          2. Thread: Lost Information

          Comment


            #6
            Re: Script for recording radio partially working with cron

            Wow maaan! you MUST REALLY be the TUX healing Shaman or somethig...

            1.- I hadn't mailx by default (don't understand why)
            2.- I installed it.
            3.- I programed the task in Kcron (user mode)
            4.- I opened my mailbox, BUT... system (who loves me) always sends good news to me...
            5.- BUT I came back to THE FOLDER and... Can you guess?... there was a pretty baby mp3 growing inside, it was being filled with data from /tmp/radio_pipe... NICE

            I suppose that mailx has somethig to do with it... don't really believe you are some kind of magician

            I'm pleased to have being "talking" to you, I've learned a lot, and your links had been really useful not only for fixing the current issue but for debugging my mind and my system too.

            Comment

            Working...
            X