Jump to content
XPEnology Community

DSM 6.2自动同步Photostation


wusx2004
 Share

Recommended Posts

本人原创文章:http://41house.net/wusx/p/119

我使用的是ESXi,数据存放虚拟机的Windows 2016中,DSM群晖通过NFS挂载photo到photostation

但是6.0以后就出现photo挂载后无法Reindex重建索引

由于更新到了DSM6.2,但是这个功能还是一直有问题,在原来的基础上整理一下成为脚本,加入任务计划自动同步DSM5.2与6.2的PhotoStation数据库内容

1.在DSM5.2中的任务计划创建一个用于导出Photostation数据库的任务,代码如下

1

pg_dump -U postgres  photo  > /volume1/basic/data/photo.sql

设定任务6小时执行一次

 

2.通过putty通过SSH方式登陆DSM6.2,通过vi创建一个sh文件,这里命名为sync_photoDb.sh

创建文件前需要使用root账号登陆执行命令,并输入登陆密码

1

sudo -i

在/Volume1的目录下通过vi创建sync_photoDb.sh

vi sync_photoDb.sh

复制粘贴下面代码

synoservice --disable pkgctl-PhotoStation

/usr/bin/dropdb -U postgres photo

/usr/bin/createdb -U postgres photo

/usr/bin/psql -U postgres  photo   < /volume1/DISK/data/photo.sql

synoservice --enable pkgctl-PhotoStation

代码大意:

·停止photostation

·删除postres中的photo数据库

·创建photo数据库

·读取在DSM5.2导出的sql文件

·恢复后启动photostation

在DSM6.2中创建一个恢复photostation数据的任务,分别用来挂在photo并且执行sync_photoDb.sh

mount -t nfs -o hard 192.168.88.219:/photo /volume1/photo

bash /volume1/sync_photoDB.sh

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...