see https://ld246.com/article/1735467806997
绿色版, 可以试试这两个帖子中所说的方法,我没有试过不知是否可行
https://ld246.com/article/1708223009893
https://ld246.com/article/1617534454945
仅启动内核, 应该启动SiYuan-Kernel.exe就可以了,亲测可行
比如,
C:\Users\Administrator\AppData\Local\Programs\SiYuan\resources\kernel\SiYuan-Kernel.exe --port 6806 --wd C:\Users\Administrator\AppData\Local\Programs\SiYuan\resources --workspace C:\siyuan
不指定工作空间默认就是上次最后打开的工作空间,详情可参考官方帮助文档内核参数
关闭内核可以用命令 taskkill /IM SiYuan-Kernel.exe /F
或通过pid关闭命令 taskkill /PID <具体的PID> /F
查看内核启动参数可用命令 wmic process where "name='SiYuan-Kernel.exe'" get CommandLine, ProcessId
注意,思源启动多个实例,监听多个端口其实是共享一个进程而不是多个进程。
mac内核启动
/Applications/SiYuan.app/Contents/Resources/kernel/SiYuan-Kernel --port 6806 --wd /Applications/SiYuan.app/Contents/Resources --workspace "/Users/wish/_data/思源笔记"
注意: 1分钟左右不访问会退出内核,需要做个心跳
see https://ld246.com/article/1745064608497
比如每 50 秒访问下 api 接口
感觉这个 api 很适合做心跳
/api/system/version
貌似思源本身也用 ws 做了心跳
推荐用 ws 试试,退出前发个消息
另外,推荐再加个守护进程管理工具做兜底方案,比如
Windows 推荐 https://nssm.cc/usage
linux 推荐 supervisord
或自己写脚本 + 定时任务
