Results 1 to 3 of 3

Thread: Cron problem

  1. #1
    Join Date
    Sep 2007
    Location
    over there
    Beans
    2,509
    Distro
    Ubuntu 12.04 Precise Pangolin

    Cron problem

    I want my computer to play a mp3, Alarum.mp3, at 9 o'clock each morning. So I ran crontab -e and added the line:

    Code:
    0 9 * * * /usr/bin/totem ~/Music/Alarum.mp3
    But at the appointed time nothing happens.

    If I type into the terminal
    Code:
     
    /usr/bin/totem ~/Music/Alarum.mp3
    totem plays the track. Where am I going wrong entering it as a cronjob?

    Cheers.
    Last edited by t0p; September 11th, 2013 at 10:41 PM.
    "All people are scum. No matter what they look like." ~ Spider Jerusalem, Transmetropolitan #4
    blog photoblog


  2. #2
    Join Date
    Jul 2005
    Location
    England
    Beans
    Hidden!

    Re: Cron problem

    Two problems with your command.
    1. You are truying to use a GUI application to carry out the timed job which requires you to export the command to a display so you will need
      Code:
      export DISPLAY=:0 && <command>
    2. I think you will need the full pathways to files you want to play with totem; I don't think cron will accept the ~/ shortcut for your home, so change that to
      Code:
      /usr/bin/totem /home/username/Music/Alarum.mp3

    Cron has only a limited range of shell actions and shortcuts available to it, so some things that will work using bash in terminal will unfortunately not work in cron, which confuses many new users.
    Last edited by ajgreeny; September 11th, 2013 at 11:34 PM.
    DISTRO: Xubuntu 14.04-64bit --- Code-tags --- Boot-Repair --- Grub2 wiki & Grub2 Basics --- RootSudo

  3. #3
    Join Date
    Feb 2007
    Location
    Petach Tikvah, Israel
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Cron problem

    Actually, I've been doing something similar for ages that has just stopped working in 13.10.

    My crontab has looked like this since Ubuntu 10.04

    00 8 * * 0,1,2,3,4 env DISPLAY=:0 /usr/bin/totem /home/changeit/alarmfile.mp3

    However, in 13.10, it simply opens an apport window.

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
  •