start_sms

# -*- coding: UTF-8 -*-
__author__ = 'EX-PENGFEI913'


import time,paramiko,re,StringIO,unicodedata


def exec_shell(command):


    f = StringIO.StringIO()
    header_match = '(\[.+?@.+?\s.+?\]\$)'
    ssh.send(command+'\n')
    while True:
        out = ssh.recv(1024)
        print out,
        f.write(out)
        header_list = re.findall(header_match, out)
        if header_list and out.strip().endswith(header_list[-1]):
            break
    return f


def check_ip(content):


    ips = re.findall('\d+\.120\.\d+\.\d+',content)
    return ips


if __name__ == '__main__':


    host = '10.59.72.161'
    port = 22
    username = 'www'
    password = '2V4B6cw9B0'


    s = paramiko.SSHClient()
    s.load_system_host_keys()
    s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    s.connect(host, port, username, password)
    ssh = s.invoke_shell()
    a=exec_shell('cd /data1/www/paf_release/sms-backend-service/public')
    exec_shell('ls')
    exec_shell('chmod -Rf +x *')
    exec_shell('/data1/env/php-fpm/bin/php pm.phar  --start --app=sms_result.php  --pidfile=sms_result.pid --daemonize -n 1')
    exec_shell('/data1/env/php-fpm/bin/php pm.phar  --start --app=send_message.php  --pidfile=send_message.pid --daemonize -n 1')
    exec_shell('ps aux|grep sms_result')
    exec_shell('ps aux|grep send_message')
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX_SMS_LENGTH 200#define MAX_NAME_LENGTH 8#define MAX_PHONE_LENGTH 11typedef struct { char word[MAX_SMS_LENGTH]; /*短信内容*/ int length; /*短信长度*/} Message;typedef struct { char name[MAX_NAME_LENGTH]; /*姓名*/ char phone[MAX_PHONE_LENGTH]; /*电话号码或手机号码*/} Note;void extract_phone_number(Message* message, Note* note) { int start = 0; int phone_start = -1; int phone_end = -1; while (start < message->length) { if (message->word[start] >= '0' && message->word[start] <= '9') { phone_start = start; phone_end = start; start++; while (start < message->length && message->word[start] >= '0' && message->word[start] <= '9') { phone_end = start; start++; } if (phone_end - phone_start == 6 || phone_end - phone_start == 7) { strncpy(note->phone, message->word + phone_start, phone_end - phone_start + 1); note->phone[phone_end - phone_start + 1] = '\0'; } else if (phone_end - phone_start == 10 || phone_end - phone_start == 11) { strncpy(note->phone, message->word + phone_start, phone_end - phone_start + 1); note->phone[phone_end - phone_start + 1] = '\0'; } if (strlen(note->phone) > 0) { break; } } else { start++; } }}void save_to_contact(Note* note) { // 将 note 存储到通讯录中}int main() { Message message; Note note; // 读取短信 fgets(message.word, MAX_SMS_LENGTH, stdin); message.length = strlen(message.word) - 1; message.word[message.length] = '\0'; memset(note.name, 0, MAX_NAME_LENGTH); memset(note.phone, 0, MAX_PHONE_LENGTH); extract_phone_number(&message, &note); save_to_contact(&note); return 0;}这个代码打开怎么使用
最新发布
06-02

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值