About a Mplayer Cron Job

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite












I'm currently tinkering with a process to play an internet radio stream on a certain schedule everyday.



After some research, I came up with this code for Crontab :



00 22 * * * mplayer http://listen.acertainradio.com >/dev/null 2>&1 
30 22 * * * pkill mplayer


Does It sounds correct? Also, I was wondering about the >/dev/null 2>&1 part. What would be the problem if I skip it?



Thank you,



Regards,










share|improve this question



























    up vote
    -1
    down vote

    favorite












    I'm currently tinkering with a process to play an internet radio stream on a certain schedule everyday.



    After some research, I came up with this code for Crontab :



    00 22 * * * mplayer http://listen.acertainradio.com >/dev/null 2>&1 
    30 22 * * * pkill mplayer


    Does It sounds correct? Also, I was wondering about the >/dev/null 2>&1 part. What would be the problem if I skip it?



    Thank you,



    Regards,










    share|improve this question

























      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I'm currently tinkering with a process to play an internet radio stream on a certain schedule everyday.



      After some research, I came up with this code for Crontab :



      00 22 * * * mplayer http://listen.acertainradio.com >/dev/null 2>&1 
      30 22 * * * pkill mplayer


      Does It sounds correct? Also, I was wondering about the >/dev/null 2>&1 part. What would be the problem if I skip it?



      Thank you,



      Regards,










      share|improve this question















      I'm currently tinkering with a process to play an internet radio stream on a certain schedule everyday.



      After some research, I came up with this code for Crontab :



      00 22 * * * mplayer http://listen.acertainradio.com >/dev/null 2>&1 
      30 22 * * * pkill mplayer


      Does It sounds correct? Also, I was wondering about the >/dev/null 2>&1 part. What would be the problem if I skip it?



      Thank you,



      Regards,







      cron mplayer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 21 at 0:47









      Rui F Ribeiro

      36.6k1271116




      36.6k1271116










      asked Aug 13 at 16:04









      Porprenaz

      1




      1




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          If you skip the redirection to /dev/null, then any output generated by the command (pkill, I assume) will be sent to your account on the system as an e-mail (which you can read from the command line with the "mail" command).



          You might also want to consider placing the full paths to the mplayer and pkill command, just to ensure that whatever shell is used can find them, irrespective of whichever environment variables (i.e. PATH) are set or not.






          share|improve this answer



























            up vote
            0
            down vote













            Just went through this. May not be the best way...but here goes.



            First I needed to auto-mount a USB containing the music. The magic line in /etc/fstab looks like this:
            LABEL=Kiwa-Music /mnt/Music auto lazytime,nofail, 1 1



            Then I did a line like this in the crontab:



            55 * * * * /home/pi/mplayerup


            Finally there the file:



            pi@kiwa-Audio:~ $ cat mplayerup



            set -x



            PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
            Proc="mplayer"



            sleep 5



            ps ax | grep -v grep | grep $Proc | grep -v mplayerup 1>/dev/null 2>/dev/null



            if [ $? = 1 ] ;



             then cd /mnt/Music/Music
            /usr/bin/mplayer -shuffle -playlist 0-Playit.m3u 1>/dev/null 2>/dev/null


            fi



            The set -x and sleep 5 are supposed to be commented out...dunno what's going on here.






            share|improve this answer




















              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462341%2fabout-a-mplayer-cron-job%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote













              If you skip the redirection to /dev/null, then any output generated by the command (pkill, I assume) will be sent to your account on the system as an e-mail (which you can read from the command line with the "mail" command).



              You might also want to consider placing the full paths to the mplayer and pkill command, just to ensure that whatever shell is used can find them, irrespective of whichever environment variables (i.e. PATH) are set or not.






              share|improve this answer
























                up vote
                2
                down vote













                If you skip the redirection to /dev/null, then any output generated by the command (pkill, I assume) will be sent to your account on the system as an e-mail (which you can read from the command line with the "mail" command).



                You might also want to consider placing the full paths to the mplayer and pkill command, just to ensure that whatever shell is used can find them, irrespective of whichever environment variables (i.e. PATH) are set or not.






                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  If you skip the redirection to /dev/null, then any output generated by the command (pkill, I assume) will be sent to your account on the system as an e-mail (which you can read from the command line with the "mail" command).



                  You might also want to consider placing the full paths to the mplayer and pkill command, just to ensure that whatever shell is used can find them, irrespective of whichever environment variables (i.e. PATH) are set or not.






                  share|improve this answer












                  If you skip the redirection to /dev/null, then any output generated by the command (pkill, I assume) will be sent to your account on the system as an e-mail (which you can read from the command line with the "mail" command).



                  You might also want to consider placing the full paths to the mplayer and pkill command, just to ensure that whatever shell is used can find them, irrespective of whichever environment variables (i.e. PATH) are set or not.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 13 at 16:13









                  Dominic Watkins

                  512




                  512






















                      up vote
                      0
                      down vote













                      Just went through this. May not be the best way...but here goes.



                      First I needed to auto-mount a USB containing the music. The magic line in /etc/fstab looks like this:
                      LABEL=Kiwa-Music /mnt/Music auto lazytime,nofail, 1 1



                      Then I did a line like this in the crontab:



                      55 * * * * /home/pi/mplayerup


                      Finally there the file:



                      pi@kiwa-Audio:~ $ cat mplayerup



                      set -x



                      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
                      Proc="mplayer"



                      sleep 5



                      ps ax | grep -v grep | grep $Proc | grep -v mplayerup 1>/dev/null 2>/dev/null



                      if [ $? = 1 ] ;



                       then cd /mnt/Music/Music
                      /usr/bin/mplayer -shuffle -playlist 0-Playit.m3u 1>/dev/null 2>/dev/null


                      fi



                      The set -x and sleep 5 are supposed to be commented out...dunno what's going on here.






                      share|improve this answer
























                        up vote
                        0
                        down vote













                        Just went through this. May not be the best way...but here goes.



                        First I needed to auto-mount a USB containing the music. The magic line in /etc/fstab looks like this:
                        LABEL=Kiwa-Music /mnt/Music auto lazytime,nofail, 1 1



                        Then I did a line like this in the crontab:



                        55 * * * * /home/pi/mplayerup


                        Finally there the file:



                        pi@kiwa-Audio:~ $ cat mplayerup



                        set -x



                        PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
                        Proc="mplayer"



                        sleep 5



                        ps ax | grep -v grep | grep $Proc | grep -v mplayerup 1>/dev/null 2>/dev/null



                        if [ $? = 1 ] ;



                         then cd /mnt/Music/Music
                        /usr/bin/mplayer -shuffle -playlist 0-Playit.m3u 1>/dev/null 2>/dev/null


                        fi



                        The set -x and sleep 5 are supposed to be commented out...dunno what's going on here.






                        share|improve this answer






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          Just went through this. May not be the best way...but here goes.



                          First I needed to auto-mount a USB containing the music. The magic line in /etc/fstab looks like this:
                          LABEL=Kiwa-Music /mnt/Music auto lazytime,nofail, 1 1



                          Then I did a line like this in the crontab:



                          55 * * * * /home/pi/mplayerup


                          Finally there the file:



                          pi@kiwa-Audio:~ $ cat mplayerup



                          set -x



                          PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
                          Proc="mplayer"



                          sleep 5



                          ps ax | grep -v grep | grep $Proc | grep -v mplayerup 1>/dev/null 2>/dev/null



                          if [ $? = 1 ] ;



                           then cd /mnt/Music/Music
                          /usr/bin/mplayer -shuffle -playlist 0-Playit.m3u 1>/dev/null 2>/dev/null


                          fi



                          The set -x and sleep 5 are supposed to be commented out...dunno what's going on here.






                          share|improve this answer












                          Just went through this. May not be the best way...but here goes.



                          First I needed to auto-mount a USB containing the music. The magic line in /etc/fstab looks like this:
                          LABEL=Kiwa-Music /mnt/Music auto lazytime,nofail, 1 1



                          Then I did a line like this in the crontab:



                          55 * * * * /home/pi/mplayerup


                          Finally there the file:



                          pi@kiwa-Audio:~ $ cat mplayerup



                          set -x



                          PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
                          Proc="mplayer"



                          sleep 5



                          ps ax | grep -v grep | grep $Proc | grep -v mplayerup 1>/dev/null 2>/dev/null



                          if [ $? = 1 ] ;



                           then cd /mnt/Music/Music
                          /usr/bin/mplayer -shuffle -playlist 0-Playit.m3u 1>/dev/null 2>/dev/null


                          fi



                          The set -x and sleep 5 are supposed to be commented out...dunno what's going on here.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Aug 24 at 18:17









                          Sydney Kotic

                          1




                          1



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462341%2fabout-a-mplayer-cron-job%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Displaying single band from multi-band raster using QGIS

                              How many registers does an x86_64 CPU actually have?