[置顶] PID算法C源代码

WEB2.0 jack 2010-6-16 10:31
```
# credential example
install -m 600 %{_sourcedir}/mysql_backup/config/ldmgr.cnf \
    %{buildroot}/etc/mysql_backup/.ldmgr.cnf


========================================
正确格式(必须紧贴)
正确写法:
install -m 600 %{_sourcedir}/mysql_backup/config/ldmgr.cnf \
    %{buildroot}/etc/mysql_backup/.ldmgr.cnf
注意:
\ 后 不能有空格 :是指:ql_backup/config/ldmgr.cnf \的\后面不能有空格,有就会报错:/root/rpmbuild/tmp/rpm-tmp.MVnKem: line 65: /root/rpmbuild/BUILDROOT/etc/mysql_backup/.ldmgr.cnf: No such file or directory
下一行必须紧接
```

```
Name:           mysql-backup
Version:        1.0.0
Release:        1%{?dist}
Summary:        MySQL multi-instance backup tool

License:        GPL
URL:            internal
BuildArch:      noarch

Requires:       bash
Requires:       gzip
Requires:       util-linux

%description
MySQL backup tool for multi-project and multi-instance environments.

Features:
- Multiple instance backup
- Credential isolation
- Project based configuration
- Automatic cleanup of old backups
- Cron scheduling
- Log rotation support
- flock based concurrency protection


%prep
# nothing required


%build
# nothing required


%install
rm -rf %{buildroot}

#
# Program directory
#

install -d %{buildroot}/usr/local/mysql_backup

#
# Config directory
#

install -d %{buildroot}/etc/mysql_backup

#
# Runtime directories
#

install -d %{buildroot}/var/lib/mysql_backup
install -d %{buildroot}/var/lock/mysql_backup
install -d %{buildroot}/app/mysql_backup
install -d %{buildroot}/data/logs/mysql_backup

#
# Cron and logrotate directories
#

install -d %{buildroot}/etc/cron.d
install -d %{buildroot}/etc/logrotate.d

#
# Install program
#

install -m 750 %{_sourcedir}/mysql_backup/mysql_backup.sh \
    %{buildroot}/usr/local/mysql_backup/

install -m 640 %{_sourcedir}/mysql_backup/db.cfg \
    %{buildroot}/usr/local/mysql_backup/

#
# Credential template
#

install -m 600 %{_sourcedir}/mysql_backup/config/ldmgr.cnf \
    %{buildroot}/etc/mysql_backup/.ldmgr.cnf

#
# Cron job
#

cat > %{buildroot}/etc/cron.d/mysql_backup << 'EOF'
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILTO=""

40 03 * * * mysql_backup /usr/local/mysql_backup/mysql_backup.sh ldmgr 10.75.17.10 3306 >> /data/logs/mysql_backup/backup.log 2>&1
EOF

chmod 644 %{buildroot}/etc/cron.d/mysql_backup

#
# Logrotate
#

cat > %{buildroot}/etc/logrotate.d/mysql_backup << 'EOF'
/data/logs/mysql_backup/*.log {
    daily
    rotate 30
    compress
    delaycompress
    missingok
    notifempty
    create 640 mysql_backup mysql_backup
}
EOF


%pre

#
# Create system group
#

getent group mysql_backup >/dev/null || groupadd -r mysql_backup

#
# Create system user
#

if ! getent passwd mysql_backup >/dev/null; then
    useradd -r \
        -g mysql_backup \
        -d /var/lib/mysql_backup \
        -s /sbin/nologin \
        -c "MySQL Backup Service" \
        mysql_backup
fi


%post

#
# Ensure runtime directories exist
#

mkdir -p /var/lib/mysql_backup
mkdir -p /var/lock/mysql_backup
mkdir -p /app/mysql_backup
mkdir -p /data/logs/mysql_backup

#
# Ownership
#

chown mysql_backup:mysql_backup /var/lib/mysql_backup
chown mysql_backup:mysql_backup /var/lock/mysql_backup
chown mysql_backup:mysql_backup /app/mysql_backup
chown mysql_backup:mysql_backup /data/logs/mysql_backup

#
# Permissions
#

chmod 750 /var/lock/mysql_backup
chmod 750 /app/mysql_backup
chmod 750 /data/logs/mysql_backup

#
# SELinux compatibility
#

if command -v restorecon >/dev/null 2>&1; then
    restorecon -R \
        /var/lib/mysql_backup \
        /var/lock/mysql_backup \
        /app/mysql_backup \
        /data/logs/mysql_backup \
        2>/dev/null || true
fi

echo "mysql-backup installed successfully."


%preun
# nothing required


%files
%defattr(-,root,root,-)

#
# parent directories
#

%dir /app
%dir /data
%dir /data/logs

#
# runtime directories
#

%dir %attr(0750,mysql_backup,mysql_backup) /var/lib/mysql_backup
%dir %attr(0750,mysql_backup,mysql_backup) /var/lock/mysql_backup
%dir %attr(0750,mysql_backup,mysql_backup) /app/mysql_backup
%dir %attr(0750,mysql_backup,mysql_backup) /data/logs/mysql_backup

#
# program
#

%dir %attr(0750,root,root) /usr/local/mysql_backup
/usr/local/mysql_backup/mysql_backup.sh
%config(noreplace) /usr/local/mysql_backup/db.cfg

#
# configuration
#

%dir %attr(0750,root,mysql_backup) /etc/mysql_backup
%config(noreplace) /etc/mysql_backup/.ldmgr.cnf

#
# cron
#

%config(noreplace) /etc/cron.d/mysql_backup

#
# logrotate
#

%config(noreplace) /etc/logrotate.d/mysql_backup


%changelog

* Mon Mar 09 2026 DevOps Team
- Enterprise initial release
- Multi-instance MySQL backup support
- Cron scheduling
- Logrotate integration
- flock lock protection
```
awk '{gsub(/\r|\n/,""); print $0 "\t" $0}' 工作簿1.csv

一行 awk 搞定:把整行先去掉内部换行,再按原样重复一次即可(默认 FS 已能识别 \t)
awk '{gsub(/\r|\n/,""); print $0 "\t" $0}' 工作簿1.csv
解释
gsub(/\r|\n/,"") —— 把记录里所有回车、换行符清掉,保证是一条完整行。
print $0 "\t" $0 —— 整行再拼一次,中间用 \t 分隔,效果就是“原列 1 原列”。
实践:https://jackxiang.com/post/13175/ 发现的问题。解决如下:

问题:
确定是目录问题: docker logs 2bb9832099fb metaPropertiesEnsemble=MetaPropertiesEnsemble(metadataLogDir=Optional.empty, dirs={/var/data/logs/kafka: EMPTY}) Formatting /var/data/logs/kafka with metadata.version 3.7-IV4. Error while writing meta.properties file /var/data/logs/kafka: /var/data/logs/kafka/bootstrap.checkpoint.tmp Creating SCRAM user: admin 目录目前如下: ls -ld /var/data/logs/kafka drwxrwxrwx@ 2 1000 1000 64 12月 11 17:34 /var/data/logs/kafka 不知道为何写入不进去,还是macbook下面的/var/data 是软链接?


回复:
在 MacBook 上使用了 /var/data/... 这种“伪路径”,它其实被 macOS 透明重写成 /private/var/data,再被 Docker Desktop 映射到容器时权限/安全层被拒。
你遇到的这个问题 100% 是 macOS 的挂载点权限机制导致的,和 Kafka、脚本、docker-compose 完全无关。
核心结论:
这是因为你在 MacBook 上使用了 /var/data/... 这种“伪路径”,它其实被 macOS 透明重写成 /private/var/data,再被 Docker Desktop 映射到容器时权限/安全层被拒。
Docker Desktop 在 macOS 上对所有 根路径 /var/ 有非常严格的限制。
这类目录:
/var
/usr
/bin
/sbin
/etc
被 macOS 视作 系统保护目录(SIP 保护),大部分情况下 不能作为 Docker volume 挂载点。
选择:------------------------------------------------
一、最快方案(免费,2 分钟) <==这个方案一旦用习惯加速度再用它,有些呆板,又切换了回来。钉钉这个企业用的办公APP得与时俱进才行呐。
点击在新窗口中浏览此图片


问题本质  
macOS 升级后,系统把「滚动加速度」算法改了,钉钉 8.x 本身又是 Electron 套壳,结果就出现  
「手指离开滚轮后,页面还继续滑一段,甚至停不下来」的感觉。  
把加速度关小、让滚动变成「行距式」就能立竿见影。

------------------------------------------------
一、最快方案(免费,2 分钟)

1. 装开源小工具 LinearMouse  
   GitHub 直接搜 LinearMouse → Releases 下载 `LinearMouse.dmg` 拖进 Applications 即可。

2. 打开后只做 3 处勾选  
   - 左侧选你的鼠标(蓝牙/有线都会列出来)  
   - 关闭 「Scrolling → Acceleration」  
   - Scrolling → Distance 选 「Line」并填 3 行(钉钉里刚好一屏聊天记录)  
   立即生效,不用重启钉钉。

------------------------------------------------
二、如果已经在用 Mos / BetterMouse

- Mos 里把 「Smooth Scrolling」强度降到 30 % 以下,  
  再把 DingTalk 加入 「例外列表」→ 平滑模式选 「Disable」即可。  
- BetterMouse 同理,把 Accel 曲线调成 Linear,行距 3 行。

------------------------------------------------
三、临时不改软件,也能缓解

- 系统设置 → 鼠标 → 把 「滚动速度」左边再降 1 格;  
- 钉钉内按 ⌘ + 0 先恢复 100 % 缩放,防止滚轮被当成缩放指令。

------------------------------------------------
四、仍不满意

- 回退钉钉:卸载当前版 → 官网下载 7.5.2 旧版(64 bit 仍能登录),  
  7.x 没有新版滚动滞后问题。

按上面任意一步做完,钉钉里滚轮就能「指哪停哪」了。祝使用愉快!
加密日志
这篇日志被加密了。请输入密码后查看。
密码
加个nofail的原因是:
防止磁盘有块挂了,再重启的时候会进入single user模式哩。


用udev 肯定能解决。
/dev/sda                /data                   xfs     defaults,nofail 0 2

UUlD=b0252554-ae09-457d-9022-0b44b68cc28c/disk2 ext4 defaults,nofail 0 2
UUlD=bd3bf106-35d8-4640-ba61-3524fc7c6408 /disk1 ex4 defaults,nofail 0 2
UUID=026bc351-1047-40c3-88bf-9a33eb47fd70 /disk3 ext4 defaults,nofail 0 2


mount -a 一下
记得加UPS
我之前R720XD, 装了5、6块硬盘,也就是当个NAS没什么处理任务,再加个UPS,也就是100多w
一块盘10W左右了
二手730XD 一两千随便搞了
买的二手服务器 挂过一次
打算弄个10盘位机箱,弄个大存储,装个freenas之类的
ldd /usr/local/php/sbin/php-fpm|grep "not found"
        libonig.so.5 => not found


rpm -ql oniguruma|grep libonig.so.5
/usr/lib64/libonig.so.5
/usr/lib64/libonig.so.5.0.0

yum install oniguruma
上次元数据过期检查:2:09:39 前,执行于 2025年02月22日 星期六 19时17分44秒。
依赖关系解决。
===================================================
软件包                                                 架构                                                版本                                                      仓库                                                    大小
===================================================
安装:
oniguruma                                              x86_64                                              6.8.2-2.el8                                               AppStream                                              187 k

事务概要
===================================================
安装  1 软件包

总下载:187 k
安装大小:676 k
确定吗?[y/N]: y
下载软件包:
oniguruma-6.8.2-2.el8.x86_64.rpm                                                                                                                                                                   719 kB/s | 187 kB     00:00    
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                               717 kB/s | 187 kB     00:00    
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                                                                                    1/1
  安装    : oniguruma-6.8.2-2.el8.x86_64                                                                                                                                                                                       1/1
  运行脚本: oniguruma-6.8.2-2.el8.x86_64                                                                                                                                                                                       1/1
  验证    : oniguruma-6.8.2-2.el8.x86_64                                                                                                                                                                                       1/1

已安装:
  oniguruma-6.8.2-2.el8.x86_64                                                                                                                                                                                                    
1. Made sure everything was updated and did; freebsd-update fetch & freebsd-update install (nothing to do becuase I was up to date).
2. freebsd-update -r 14.1-RELEASE upgrade
3. freebsd-update install
4. shutdown -r now
5. freebsd-update install
6. shutdown -r now (maybe overkill)
7. pkg-static upgrade -f
8. freebsd-update install (nothing to do)
9. shutdown -r now

freebsd-version -kru gave me;
14.1-RELEASE
14.0-RELEASE
14.1-RELEASE

Then I did freebsd-update fetch & freebsd-update install and the system reverted back to 14.0
来自:https://forums.freebsd.org/threads/upgrading-to-14-1.93700/

实践如下:
freebsd-update fetch & freebsd-update install

[root@core ~]# sudo freebsd-update install
No updates are available to install.
Run '/usr/sbin/freebsd-update fetch' first.
[root@core ~]# uname  -rasp
FreeBSD core.hatch.l.lw4.cn 14.0-RELEASE-p9 FreeBSD 14.0-RELEASE-p9 #0: Tue Aug  6 19:52:06 UTC 2024     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 amd64
[root@core ~]# freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 14.0-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 14.0-RELEASE-p9.
You have new mail in /var/mail/root
[root@core ~]# freebsd-update -r 14.1-RELEASE upgrade
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 14.0-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic kernel/generic-dbg src/src world/base world/lib32

The following components of FreeBSD do not seem to be installed:
world/base-dbg world/lib32-dbg

Does this look reasonable (y/n)? y

Fetching metadata signature for 14.1-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files...
6490....6500....6510....6520....6530....6540....6550....6560....6570....6580....6590....6600....6610....6620....6630....6640....6650....6660....6670....6680....6690....6700....6710....6720....6730....6740....6750....6760....6770....6780....6790....6800....6810....6820....6830....6840....6850....6860....6870....6880....6890....6900....6910....6920....6930....6940....6950.Timeout, server 10.10.0.1 not responding.


Freebsd升级到这一步,不想升级了,清理掉产生的内容,怎么弄?
freebsd-update rollback
rm -rf /var/db/freebsd-update/*
rm -rf /usr/freebsd-update/*

远程桌面连接linux服务器时,画面突然放大,且画面随光标移动。
解决方法
Alt + 鼠标滑轮
Alt + 鼠标滑轮可以进行画面的放大、缩小。有的时候不注意按到键盘,可能出现这种情况。特此记录。
摘自:https://blog.csdn.net/ykwjt/article/details/127451351

macbook下面是option+鼠标滑轮(苹果鼠标二手指前后移动=远程屏幕放大缩小)
1.布局:
切换到 Side By Side Layout,这个布局,更方便操作。
点击在新窗口中浏览此图片
界面主要包括:正则表达式、测试文本、输出结果、历史记录、Create相关面板,见上图。

2.List All:输出结果面板,显示的显示了正则表达式的匹配结果。你可以通过List All切换显示的效果,如下图所示:
点击在新窗口中浏览此图片
可以选中List ALL Group Matches in columns显示的效果,就是上面图中的输出结果面板效果。如果,你选中了Update Automatically,则修改正则或文本内容时候,输出结果面板会实时跟着变化。

3.高亮:
点:Highlight,打开高亮。

4.Debug:
点击 Debug按钮,会自动跳到Debug面板,显示出正则表达式匹配的规则。通过该结果,你可以很直观的分析出正则匹配的过程,如下图所示:
点击在新窗口中浏览此图片

5.一行还是多行匹配:
测试文本面板(Test标签)输入需要测试的文本内容,如:。可以选择Line By Line、Whole File、Page By Page,来指定是每行抽取,还是对整个文档抓取等(如果你的正则匹配信息有包含多行内容,务必要选中Whole File或者Page By Page)。

来自:https://jingyan.baidu.com/article/63acb44a2d9c7761fcc17ebd.html
正则工具:https://regex101.com/
iOS 系统自带的“相机”应用无法进行删除,也就是说正常情况下不会丢失该功能。如果您无法在 iPhone 桌面上找到“相机”应用,可以从资源库中找到并移回至桌面,或检查“屏幕使用时间”设置。

  1.打开资源库查找“相机”:

  在 iPhone 桌面上连续向左轻扫,直至看到“应用资源库”,在资源库中找到“相机”图标,长按拖回到桌面,放置到理想的位置即可。

来自:https://g.pconline.com.cn/x/1585/15859231.html
分页: 1/338 第一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 下页 最后页 [ 显示模式: 摘要 | 列表 ]