kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

localtime函数

https://www.php.cn/faq/631443.html

localtime函数的原型是

1
struct tm *localtime(const time_t *timep);

这个函数接受一个指向 time_t 类型的指针作为参数,返回一个指向structtm类型的指针,表示本地时间。

localtime是一个常用的函数,它可以将一个时间戳转换为一个本地时间的结构体。

time_t 是一个表示时间戳的数据类型,它通常是一个长整型(long int),表示自 1970 年 1 月 1 日以来经过的秒数。structtm 是一个表示日期和时间的结构体,它包含了年、月、日、时、分、秒等信息。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <time.h>

int main()
{
	time_t timestamp = time(NULL);            // 获取当前的时间戳
	structtm *local_time = localtime(timestamp);  // 将时间戳转换为本地时间

	// 输出本地时间的各个字段
	printf("Year: %d\n", local_time->tm_year + 1900);  // 加1900是为了得到实际的年份
	printf("Month: %d\n", local_time->tm_mon + 1);     // 加1是为了得到实际的月份(1-12月)
	printf("Day: %d\n", local_time->tm_mday);
	printf("Hour: %d\n", local_time->tm_hour);
	printf("Minute: %d\n", local_time->tm_min);
	printf("Second: %d\n", local_time->tm_sec);
	printf("Day of week: %d\n", local_time->tm_wday);  // 周几,从0开始计数,0表示星期一,6表示星期日
	printf("Day of year: %d\n", local_time->tm_yday);  // 一年中的第几天,从0开始计数,0表示1月1日,365表示12月31日
	printf("Zone: %s\n", asctime(local_time));        // 输出本地时间的字符串表示,例如:"Wed Jun 30 21:49:08 1993\n"

	return 0;
}

山特UPS NMC卡 USHA卡

使用UPS自带的DB9+winpower,会时不时的中断,PL2303驱动会经常蓝屏


NMC卡 更新, mini USHA卡 更旧

NMC 卡

默认密码 password

WEB 默认账号 root

山特UPS_NMC使用说明.pdf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
NMC Version 2.7.0.a
+============================================================================+
|                   Network Management Card Configure Menu                   |
+============================================================================+
Password:********

NMC Version 2.7.0.a
+============================================================================+
|                   Network Management Card Configure Menu                   |
+============================================================================+
  1. IP Configurations
  2. Pass Through
  3. Reset Configuration to default
  4. Restart
  5. Change Password
  6. Network Access Control
  0. Exit

Please Enter Your Choice : 1

+============================================================================+
|                             IP Configure Menu                              |
+============================================================================+
     MAC Address : 00:20:85:E5:CC:15
  1. DHCP        : Enable
     IP address  : 0.0.0.0
     Subnet mask : 0.0.0.0
     Gateway     : 
     Primary DNS address   : 
     Secondary DNS address : 
  7. IPv6 Configure
  0. Return to previous menu

Please Enter Your Choice : 1

Enable/Disable DHCP - [Enabled]
   1. Enable
   2. Disable
   0. Return to previous menu

Please Enter Your Choice -> 2

IP address [] 192.168.1.253
Subnet mask [] 255.255.255.0
Gateway [] 192.168.1.254
IAM:Got STATIC IPv4 address 192.168.1.253 on interface eth0
+============================================================================+
|                             IP Configure Menu                              |
+============================================================================+
     MAC Address : 00:20:85:E5:CC:15
  1. DHCP        : Disable
  2. IP address  : 192.168.1.253
  3. Subnet mask : 255.255.255.0
  4. Gateway     : 192.168.1.254
  5. Primary DNS address   : 192.168.187.1
  6. Secondary DNS address : 192.168.187.2
  7. IPv6 Configure
  0. Return to previous menu

Please Enter Your Choice : 5

Primary DNS address [192.168.187.1] 218.85.157.99

IAM - lost STATIC IPv4 address 192.168.1.253 on interface eth0
IAM:Got STATIC IPv4 address 192.168.1.253 on interface eth0
+============================================================================+
|                             IP Configure Menu                              |
+============================================================================+
     MAC Address : 00:20:85:E5:CC:15
  1. DHCP        : Disable
  2. IP address  : 192.168.1.253
  3. Subnet mask : 255.255.255.0
  4. Gateway     : 192.168.1.254
  5. Primary DNS address   : 218.85.157.99
  6. Secondary DNS address : 192.168.187.2
  7. IPv6 Configure
  0. Return to previous menu

Please Enter Your Choice : 

mini USHA 卡

似乎电池电压读的不对??

默认密码 admin

WEB默认账号 WebPower PDF上写是 USHA

山特UPS_miniUSHA使用说明.pdf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
WebPower Pro II Mini Card v5.27 (SN 11120051216073) Ready
  

Enter Password: ********


+============================================================================+
|               [ WebPower Configuration Utility Main menu ]                 |
+============================================================================+
   1. WebPower Configuration
   2. UPS Parameters
   3. Access Control Table
   4. Trap Receiver Table
   5. SNMPv3 USM Table
   6. Reset Configuration To Default
   7. Restart WebPower
   8. UPS Pass-Through
   0. Exit

Please Enter Your Choice => 1


+============================================================================+
|                     [ WebPower Configuration Menu ]                        |
+============================================================================+
   1. System Group
   2. Control Group
   3. Parameter Group
   4. Email Group
   5. Ping Group
   0. Return to previous menu

Please Enter Your Choice => 1


+============================================================================+
|                   [ System Group Configuration Menu ]                      |
+============================================================================+
      WebPower Version : WebPower Pro II Mini Card v5.27 (SN 11120051216073)
      Ethernet address : 00 E0 D8 17 9D 63 
   1. Ip Address       : 172.17.157.99
   2. Gateway Address  : 0.0.0.0
   3. Network Mask     : 255.255.0.0
   4. Date and Time
   0. Return to previous menu

Please Enter Your Choice => 1
Enter IP address : [172.17.157.99] 192.168.1.253
 

+============================================================================+
|                   [ System Group Configuration Menu ]                      |
+============================================================================+
      WebPower Version : WebPower Pro II Mini Card v5.27 (SN 11120051216073)
      Ethernet address : 00 E0 D8 17 9D 63 
   1. Ip Address       : 192.168.1.253
   2. Gateway Address  : 255.255.255.0
   3. Network Mask     : 255.255.0.0
   4. Date and Time
   0. Return to previous menu

Please Enter Your Choice => 2
Enter GW address : [255.255.255.0] 192.168.1.254


+============================================================================+
|                   [ System Group Configuration Menu ]                      |
+============================================================================+
      WebPower Version : WebPower Pro II Mini Card v5.27 (SN 11120051216073)
      Ethernet address : 00 E0 D8 17 9D 63 
   1. Ip Address       : 192.168.1.253
   2. Gateway Address  : 192.168.1.254
   3. Network Mask     : 255.255.0.0
   4. Date and Time
   0. Return to previous menu

Please Enter Your Choice => 3
Enter Network Mask : [255.255.0.0] 255.255.255.0


+============================================================================+
|                   [ System Group Configuration Menu ]                      |
+============================================================================+
      WebPower Version : WebPower Pro II Mini Card v5.27 (SN 11120051216073)
      Ethernet address : 00 E0 D8 17 9D 63 
   1. Ip Address       : 192.168.1.253
   2. Gateway Address  : 192.168.1.254
   3. Network Mask     : 255.255.255.0
   4. Date and Time
   0. Return to previous menu

Please Enter Your Choice => 0

+============================================================================+
|                     [ WebPower Configuration Menu ]                        |
+============================================================================+
   1. System Group
   2. Control Group
   3. Parameter Group
   4. Email Group
   5. Ping Group
   0. Return to previous menu

Please Enter Your Choice => 2


+============================================================================+
|                   [ Control Group Configuration Menu ]                     |
+============================================================================+
   1. HTTP Login Username       : WebPower
   2. Community Read-Only       : public
   3. Community Read/Write      : *
   4. BOOTP/DHCP Control        : Enabled
   5. TFTP/HTTP Upgrade Control : Enabled
   6. PING Echo Control         : Enabled
   7. Telnet Control
   8. HTTP Control
   9. SNMP Control
   A. SMTP Port                 : 25
   B. SSH Control
   0. Return to previous menu
Please Enter Your Choice => 1
Enter Username : [WebPower] USHA


+============================================================================+
|                   [ Control Group Configuration Menu ]                     |
+============================================================================+
   1. HTTP Login Username       : USHA
   2. Community Read-Only       : public
   3. Community Read/Write      : *
   4. BOOTP/DHCP Control        : Enabled
   5. TFTP/HTTP Upgrade Control : Enabled
   6. PING Echo Control         : Enabled
   7. Telnet Control
   8. HTTP Control
   9. SNMP Control
   A. SMTP Port                 : 25
   B. SSH Control
   0. Return to previous menu

Please Enter Your Choice => 8


+============================================================================+
|                       [ HTTP Configuration Menu ]                          |
+============================================================================+
   1. HTTP Control          : Enabled
   2. HTTP Port             : 80
   3. HTTP Security Control : Disabled
   4. UPnP Control          : Disabled
   0. Return to previous menu

Please Enter Your Choice =>