cron
Manage cron on Norns via Maiden
When initialized, this mod creates a crontab file at data/cron/crontab and loads it as the file for the we user. This starter crontab file contains a recursive cron job that reloads itself each minute, so user edits will get picked up by the system automatically.
If you want it to reload faster, you can do so in the mod menu.
For more about what cron is and how to structure a crontab file, Wikipedia has a decent overview with some examples. If you’ve ever run a command using os.execute() in Maiden, that’s the sort of thing that could be scheduled here.
Be aware that there may be some funkiness with time, especially when you don’t have a network connection. Stuff may run at unexpected times, so don’t rely on this for super-precise tasks.
NOTE: check your time zone! After setting it with sudo raspi-config, you may still need to restart in order for cron to pick up the change.
Example cron jobs
# back up norns at 4am every day
0 4 * * * rsync -avzx /home/we/dust user@server:/path/to/backup/
# save list of installed engines at midnight
@daily find ~/dust -name Engine_*.sc -type f -printf '%f\n' | sort > ~/data/engines.txt
# current weather at my location, every 5 minutes
/5 * * * * curl -s wttr.in/?format=Current%20weather%20in%20%l%20is%20%C%20and%20temperature%20wind%20speed%20is%20%w | espeak -k20 -s 120 -m -w ~/dust/audio/weather.wav
# grab freesound.org random sound of the day
15 4 * * * curl https://freesound.org$(curl -s https://freesound.org | grep mp3_file | head -n 1 | cut -d' ' -f11 | cut -d'"' -f2) -o ~/dust/audio/freesound.ogg && ffmpeg -n -i ~/dust/audio/freesound.ogg ~/dust/audio/freesound.wav && rm ~/dust/audio/freesound.ogg
Requirements
Norns running 210927 or later
Download
Install
In the maiden REPL:
;install https://github.com/stvnrlly/cron.git
As a mod, you’ll then need to do some extra stuff to enable it :
to enable a mod go to SYSTEM > MODS to see the list of installed mods. mods which are loaded will have a small dot to the left of their name. use E2 to selected an item in the list and then use E3 to enable or disable as appropriate. unloaded mods will show a + to the right their name to indicate that they will be enabled (and thus loaded) on restart. loaded mods will show a - to the right of their name indicating they will be disabled on restart.