Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    4

    Cron & Picoreplayer

    hello,
    I have a Raspberrypi with picoreplayer installed. All works fine.
    However I would like to launch a script at a certain time and another script at another time ( Power on the amplifier at 7:00 in the morning and power off at 8:00).
    Is it possible to have several script via the Shedule CRON jobs? the first command is writed successfully and works but when I write a second one, it overwrite the first one.

    regards

  2. #2
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    3,005
    It’s just Linux so if you set up chron correctly it will work
    VB2.4 storage QNAP TS419p (NFS)
    Living Room - Joggler & SB3 -> Onkyo TS606 -> Celestion F20s
    Office - Pi3+Sreen -> Sony TAFE320 -> Celestion F10s / Pi2+DAC & SB3 -> Onkyo CRN755 -> Wharfedale Modus Cubes
    Dining Room -> SB Boom
    Kitchen -> UE Radio (upgraded to SB Radio)
    Bedroom (Bedside) - Pi2+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) - SB Touch ->Sherwood AVR ->Mordaunt Short M10s
    Everything controlled by iPeng

  3. #3
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,194
    Quote Originally Posted by 38domo View Post
    hello,
    I have a Raspberrypi with picoreplayer installed. All works fine.
    However I would like to launch a script at a certain time and another script at another time ( Power on the amplifier at 7:00 in the morning and power off at 8:00).
    Is it possible to have several script via the Shedule CRON jobs? the first command is writed successfully and works but when I write a second one, it overwrite the first one.

    regards
    Well for me the PCP comment regarding that feature says: "This feature gives advanced users the possibility to manipulate the cron scheduler. It will allow users to add a single command to the cron job or to schedule a script that performs multiple actions."

    So I guess this suggests a wrapper script launched twice daily from cron, that checks time-of-day and runs an "up" or "down" command.
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  4. #4
    Junior Member
    Join Date
    Dec 2017
    Posts
    4
    hello,
    I have tried to set cron manually using vi and add several lines. It's works BUT when you save from PCP interface or reboot PCP the manual entries are lost and PCP keeps only the one entry from PCP interface. so it's seems PCP is programmed to have only one line in Cron.

  5. #5
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,302
    hi 38domo,

    Did you do a backup to save changes?

    /opt/.filetool.lst contains the entry var/spool/cron/crontabs, so your cron settings will be re-installed after a reboot if you do a backup ($pcp bu).

    piCore is RAM based so the file system is in memory, without a backup to store changed files to mydata changes will not be preserved.

    regards
    Greg

    This is the cron test I use.

    Code:
    */1 0 * * * date >> /tmp/crontime0
    */1 1 * * * date >> /tmp/crontime1
    */1 2 * * * date >> /tmp/crontime2
    */1 3 * * * date >> /tmp/crontime3
    */1 4 * * * date >> /tmp/crontime4
    */1 5 * * * date >> /tmp/crontime5
    */1 6 * * * date >> /tmp/crontime6
    */1 7 * * * date >> /tmp/crontime7
    */1 8 * * * date >> /tmp/crontime8
    */1 9 * * * date >> /tmp/crontime9
    */1 10 * * * date >> /tmp/crontime10
    */1 11 * * * date >> /tmp/crontime11
    */1 12 * * * date >> /tmp/crontime12
    */1 13 * * * date >> /tmp/crontime13
    */1 14 * * * date >> /tmp/crontime14
    */1 15 * * * date >> /tmp/crontime15
    */1 16 * * * date >> /tmp/crontime16
    */1 17 * * * date >> /tmp/crontime17
    */1 18 * * * date >> /tmp/crontime18
    */1 19 * * * date >> /tmp/crontime19
    */1 20 * * * date >> /tmp/crontime20
    */1 21 * * * date >> /tmp/crontime21
    */1 22 * * * date >> /tmp/crontime22
    */1 23 * * * date >> /tmp/crontime23

  6. #6
    Junior Member
    Join Date
    Dec 2017
    Posts
    4
    hello,
    thanks a lot for your response.
    I have not do a backup, only a SAVE. But when I create an entry in Custom Cron command, save it, I retrieve it in / var/spool/cron/crontabs/root
    after reboot the line is still present.
    if i re-create a different entry in custom cron command, save it, I can see it is savec in cron file file but the previous one is deleted.

    I will try to add manually via putty and test
    regards

  7. #7
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,302
    hi 38domo,

    Don't try to do it via the web interface and manually at the same time. I assumed you were doing it manually.

    Clear settings from web interface. I would be tempted to start from a new image.

    Just a couple of warnings, I remember when I originally did this there were issues with getting the right owner tc/root and timezone issues.

    Note there is a "cron" bootcode that is always present in piCorePlayer.

    Code:
    Usage: crontab [-c DIR] [-u USER] [-ler]|[FILE]
    
            -c      Crontab directory
            -u      User
            -l      List crontab
            -e      Edit crontab
            -r      Delete crontab
            FILE    Replace crontab by FILE ('-': stdin)
    You need to do a $pcp bu when you change crontab.

    regards
    Greg
    Last edited by Greg Erskine; 2017-12-07 at 15:11.

  8. #8
    Junior Member
    Join Date
    Dec 2017
    Posts
    4
    hello,
    it's works fine when updating cron manually ( I let it clear in pcp web interface)
    Is there a way to launch squeezelite commands via cron ( start/stop/pause) ???
    regards
    gerard

Posting Permissions

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