bot writes script

Discover bot writes script, include the articles, news, trends, analysis and practical advice about bot writes script on alibabacloud.com

Python writes MySQL automatic backup script

#!/usr/bin/env python# -*- coding: utf-8 -*-# filename: mysql_dump.pyimportosimporttimeimportstring‘‘‘ defined variable ‘‘‘databases=‘--database kbss_kcas reportdb koacif sequence infocenter‘sql_user=‘root‘sql_pwd=‘123456‘‘‘‘ Defining the remote backup variables ‘‘‘jv_test01_dir="/opt/mysql"‘‘‘ Create the backup file directory ‘‘‘mkdir_dir="/opt/"+time.strftime(‘%Y%m‘)+"/"ifnotos.path.exists(mkdir_dir):os.mkdir(mkdir_dir)print‘Successfully created directory‘, mkdir_dir‘‘‘ Start backup of databas

ASP. NET Server writes JavaScript script to client

" rendering:5, RegisterHiddenField: Automatically generate a Service-side code: this. Clientscript.registerhiddenfield ("HiddenField", "I ' m a hidden");Client "source file" rendering:6, Registeronsubmitstatement: In the client form of the onsubmit event, the specified code is automatically addedService-Side code: This. Clientscript.registeronsubmitstatement (this. GetType (), "onsubmit1", "var onsubmit11=1;");This. Clientscript.registeronsubmitstatement (this. GetType (), "Onsubmit2", "var onsu

The Python language--crontab writes logs to a file every day, in conjunction with a Python script implementation

First, the foregoingThere are a lot of ways that Python scripts can be written to log files on a daily basis in the actual work, and there are a number of methods to achieve this effect. This article chooses a way to realize, special will realize the detail to do the following to share, improper place please correct.Second, the specific1. The Python script needs to add logger output to each Python file.As follows:2. Add a background execution mechanis

Python writes a hotup.sh script that executes under the specified path

#!/usr/bin/env python#coding:utf-8import osimport reimport sysnum = []game_gen_path = ‘/data/bz-tw-and/‘for dirs in os.listdir(game_gen_path): if re.match(‘s\d+‘,dirs): num.append(dirs[1:])number = sorted(map(int,num))def callable(input_args): if input_args == ‘start‘: for i in number: script_abs_path = game_gen_path + ‘s‘ + str(i) + ‘/bin/hotup.sh‘ os.system(‘\nsh %s\n‘ % script_abs_path) print(‘ \033[31m%d\033[0m service alerady execute‘ % i

Python writes JSON script monitoring port

#json脚本#!/usr/bin/env pythonimport osimport jsondata = []command="ps aux | grep bz-tw-and-s | awk ‘{print $11}‘ | awk -F‘/‘ ‘{print $2}‘| grep -v ‘^$‘"service = os.popen(‘%s‘ % command ,‘r‘).readlines()for service in service: service_name = ‘‘.join(service).strip() data += [{‘{#SITENAME}‘: service_name}]print json.dumps({‘data‘:data},sort_keys=True,indent=7,separators=(‘,‘,‘:‘))#监控端口#!/usr/bin/env pythonimport osimport sysservice_name = sys.argv[1]process_command = "ps aux | grep %s | grep -v gr

Total Pages: 2 1 2 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.