In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Problem description
In a project scenario, a Windows server runs a Python script to collect data from the Internet and copy the data file to the NFS of the intranet. The Python version is 2.7 and the Windows version is 2008 R2 (6.1.7600.2.0.0.274.10). After Windows mounts the remote NFS directory (mapping the network drive to the local Z disk), it is no problem to use Windows Explorer to open the remote directory and copy files. At the same time, if you execute python xx_data_collect.py under cmd alone, the data can also be copied to the remote directory normally. Use Windows to schedule the xx_data_collect.py script every 5 minutes. The script has been scheduled, but the data cannot be copied. When executing os.path.exists (targetPath), the exception "Target file path: Z:\ rfid\ xx_data\ directory does not exist" is thrown. This Windows runs 5 types of data collection scripts with the same structure and function. The scheduled task scheduling of 4 types of data (frequency 5 minutes) can not identify the NFS directory, and type 1 data (traffic, frequency of 1 month) is normal.
Problem location and verification scheduled task properties: check the scheduled task properties, copy normal type 1 data (traffic) scheduled tasks, modify the scheduled Python script, execute again or report that the directory does not exist. NFS Client: check the registry and no problems are found. Schedule task scheduling BAT: try to write a bat, execute xx_data_collect.py, and then schedule bat by the scheduled task. Add "NET USE z://192.168.1.x/data/PERSISTENT:YES" to the bat content. Execute again or report that the directory does not exist. The problem with the NFS directory: configure the Target directory as the local directory of the operating system, and the scheduled task scheduling execution copy is normal. Configure the Target directory to another NFS directory and execute it again or report that the directory does not exist.
So far, the real problem has not been found, so we can only think of other ways to solve it. Solution method
Change the scheduling mode of the scheduled task, write a bat script, and put it into boot self-startup. Note: receive script is responsible for obtaining data from the Internet and belongs to resident memory, while collect script is responsible for copying data files to the corresponding directory of NFS. The contents are as follows:
@ echo off
:: detection interval (in seconds)
Set _ interval=300
Set _ processName= "xx_data_receive"
:: start command for processes that need to be guarded
Set _ processCmd=python E:\ apps\ xx_data_collect.py
:: processes that need to be guarded estimate how long it will take to start up (in seconds)
Set _ processTimeout=10
: LOOP
Echo "xx_data_receive program keeper is working!"
Echo% _ processCmd%
:: the process ID that needs to be guarded. When the xx_data_receive program starts, it will write pid to the file.
Set / p processID=.\ ImportantPID\ xx_tmp.txt
:: xx_tmp.txt status file, the above filter returns 0 or 1
Set / p aliveFlag= nul
)
Goto LOOP
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.