PDA

View Full Version : Cron & Picoreplayer



38domo
2017-12-05, 13:11
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

d6jg
2017-12-05, 13:57
Itís just Linux so if you set up chron correctly it will work

epoch1970
2017-12-05, 13:59
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.

38domo
2017-12-06, 00:13
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.

Greg Erskine
2017-12-06, 02:06
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.


*/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

38domo
2017-12-06, 09:31
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

Greg Erskine
2017-12-07, 15:09
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.


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

38domo
2017-12-23, 01:54
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