0
0
Raspberry Piprogramming~10 mins

Cron jobs for scheduled tasks in Raspberry Pi - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to schedule a cron job that runs every minute.

Raspberry Pi
*/1 * * * * [1]
Drag options to blanks, or click blank then click option'
Arun script.py
B/usr/bin/python3 /home/pi/script.py
Cpython script.py
Dexecute script.py
Attempts:
3 left
💡 Hint
Common Mistakes
Using just 'python script.py' without full path causes cron to fail.
2fill in blank
medium

Complete the cron schedule to run a job every day at 2:30 AM.

Raspberry Pi
30 [1] * * * /home/pi/backup.sh
Drag options to blanks, or click blank then click option'
A2
B14
C3
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 14 instead of 2 runs at 2 PM, not 2 AM.
3fill in blank
hard

Fix the error in the cron job that should run every Sunday at midnight.

Raspberry Pi
0 0 * * [1] /home/pi/weekly_report.sh
Drag options to blanks, or click blank then click option'
A7
B0
CSun
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or 7 can be ambiguous depending on cron version.
4fill in blank
hard

Fill both blanks to create a cron job that runs every 15 minutes and logs output.

Raspberry Pi
[1]/15 * * * * /home/pi/script.sh > [2] 2>&1
Drag options to blanks, or click blank then click option'
A*/
B/var/log/script.log
C/tmp/script.log
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' instead of '*/' causes the job to run every minute.
5fill in blank
hard

Fill all three blanks to create a cron job that runs at 5:45 PM on weekdays and emails output.

Raspberry Pi
[1] 45 17 [2] [3] /home/pi/daily_report.sh | mail -s "Report" user@example.com
Drag options to blanks, or click blank then click option'
A1-5
B1,2,3,4,5
C1-7
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing day of month and day of week fields.