Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Linux deploy python crawler scripts and set scheduled tasks

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the "Linux how to deploy python crawler script and set scheduled tasks" related knowledge, Xiaobian through the actual case to show you the operation process, the method of operation is simple and fast, practical, I hope that this "Linux how to deploy python crawler script and set scheduled tasks" article can help you solve the problem.

The implementation steps are as follows:

1. Install pip (python2.6 comes with the operating system and can be used directly, but without pip)

# download pip installation package wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb"-- no-check-certificate# extract installation package and install tar-xzvf pip-1.5.4.tar.gzcd pip-1.5.4python setup.py install

two。 Install third-party libraries with pip

Pip install pygresql==5.0.3pip install requests==2.18.3

3. Set up scheduled tasks

# enable scheduled task service service crond start# to view scheduled task service status service crond status# open scheduled task editing window crontab-e # add two scheduled tasks, that is, execute each day at 00:00 and 12:20 And write to the log 00 * / usr/bin/python / home/longrise/psrd/collect.py > / home/longrise/psrd/collect.log 2 > & 1 & 20 12 * / usr/bin/python / home/longrise/psrd/collect.py > / home/longrise/psrd/collect.log 2 > & 1 & scheduled task syntax as follows: # for details see man 4 crontabs# example of job definition:#.- -minute (0-59) # |.-hour (0-23) # | |.-day of month (1-31) # |.-month (1-12) or jan Feb,mar,apr... # |.-day of week (0-6) (sunday=0 or 7) or sun,mon,tue,wed,thu,fri,sat# | # * user-name command to be executed on "how to deploy python crawler scripts and set scheduled tasks by Linux" ends here Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report