There is a python script that I want to run as a cronjob with a given probability.
Lets say I want to run that file at after reboot. Thus, using @reboot /path/to/file
I don't know whether setting a probability is possible with cronjobs. Currently I'm using another python script to run the desired script. Is there a better way to do this?
Add a probability call to the Python script.
import sys
from random import random
run_script_prob = 0.3
if random() > run_script_prob:
sys.exit(0)