月度归档:2024年06月

CRONTAB log

Jun 15 00:00:01 zgs CRON[21808]: (root) CMD (sh /home/zgs/www.sh )
Jun 15 00:04:21 zgs CRON[21807]: (CRON) info (No MTA installed, discarding output)

crontab 定时任务 自动化运维

crontab -e 进入变价

分 时 天(不可以为0) (不可以为0) (0 7表示周日) sh *.sh

每2分钟执行一次

*/2 * * * *

每分钟执行一次
* * * * *

1:00 执行一次
0 1 * * *

1号 每分钟执行一次
* * 1 * *

1号 1:00执行一次
0 1 1 * *

每周1 1:00执行一次
0 1 * * 1

expect 自动化运维 SCP自动输入密码 FTP

apt install except

范例 upscp.exp 文件

set timeout 60

spawn scp -r ./release/ root@127.0.0.1:/opt/

expect “*password:”

send “123456\n”

expect eof

解释 解释 解释 解释 解释

设置超时未60秒,默认10秒 若使用SCP FTP传输 10秒可能无法将全部信息发送 建议更具文件大小设置

写完之后 将文件保存为 upscp.exp,每个expect脚本spawn只能使用一次,相当于监控该命令

添加写入权限 chmod +x upscp.exp

执行 ./upscp.exp 即可

可以先写一个shell脚本用于操作备份(back.sh),最后在脚本中加入exp脚本用于传输操作

./upscp.exp

#!/usr/bin/expect -f
set timeout 60
spawn scp -r ./release/ root@127.0.0.1:/opt/
expect "*password:"
send "123456\n"
expect eof
spawn ftp ftp.test.com
expect "Name"
send "user\r"
expect "Password:"
send "123456\r"
interact

windows开机自启动CMD脚本 python http.server

Windows+R 启动:shell:startup

在其中创建bat脚本 server.bat


@echo off
d:
cd d:\aaa\bbb
python -m http.server 80 --bind 192.168.1.1


在D:\aaa\bbb下为根目录 创建python的web微服务

创建完成后可以先运行bat脚本,验证是否正确。

windows server 管理 记得开启入站规则 TCP 80端口

PS:

http.server 中的 -d 参数可以指定目录

TAG VPS 大盘鸡

10刀 2TB 流量4TB 1Gbps 之后100Mbps无线(30TB)
Shopping Cart – Servarica 年付110刀

特价5刀2TB 2核心 年付48刀

https://servarica.com/clients/aff.php?pid=459



Big HDD | Cheap Storage VPS | High Storage VPS – Crunchbits

6刀2TB PA节点 6TB流量




https://panel.ihostart.com/index.php?rp=/store/storage

6.3欧元 4TB IO 25MB/s 100Mbps 4K Iops

9.1 7TB IO 30MB/s 100Mbps 5.7K Iops