In the previous chapter, we completed the Python script (blocker.py) and verified that it runs correctly. Now, the next step is to deploy it so it runs automatically at system startup.
The method for deploying a script at startup depends on the operating system. In this section, we will focus on Linux (and briefly mention Windows).
To run a script at startup on Linux, we need to configure an entry in the crontab schedule.
Crontab is a list of commands that are scheduled to run at specified intervals. The term crontab stands for cron table, which defines when and how scripts are executed automatically at regular intervals.
Follow the following steps.
Open the crontab with the -e flag. Run the following command on the terminal on Linux.
This will open a crontab file which looks like following.

Now add the following line to the file and save it.

Restart the system now. On reboot, our script blocker.py is scheduled to run at system start-up. As of now, we are in working hours. So let's try to open the Facebook on the browser.

As shown in the above image, the website www.facebook.com is refused to connect. Hence, our script is working fine on the system start-up as the website is refused to connect.
We request you to subscribe our newsletter for upcoming updates.