In this example, we’re setting up a job, which will run at 08:00 am daily and clean rails logs
Step 1 – create a file with what we want to run (delete_logs.sh):
#!/bin/(shell) cd ~/code/rails_project /Users/username/.rbenv/shims/bundle exec rake log:clear
Setp 2 – set up the cron scheduler:
$ env EDITOR=vim crontab -e # Add the line to run the script at 8am daily: 0 8 * * * sh ~/scripts/delete_logs.sh >/tmp/stdout.log 2>/tmp/stderr.log