- Mitglied seit
- 19. Aug 2010
- Beiträge
- 28
- Punkte für Reaktionen
- 0
- Punkte
- 1
cp /volume1/public/S20pgsql.sh /usr/syno/etc.defaults/rc.d
chown root:root /usr/syno/etc.defaults/rc.d/S20pgsql.sh
chmod 755 /usr/syno/etc.defaults/rc.d/S20pgsql.sh
setzt Eigentümer und Gruppenzugehörigkeit.Was macht das chown root:root ?
DiskStation> sh -x /usr/syno/etc/rc.d/S20pgsql.sh
+ PREFIX=/usr/syno/pgsql
+ PGBIN=/usr/syno/pgsql/bin
+ POSTGRESQL_CONF=/usr/syno/pgsql/etc/postgresql.conf
+ PGHBA_CONF=/usr/syno/pgsql/etc/pg_hba.conf
+ MY_VERSION=8.3
+ /bin/get_key_value /etc.defaults/synoinfo.conf unique
+ cut -d_ -f2
+ MY_PLATFORM=x86
+ CMD_GET_PG_PATH=/usr/syno/bin/servicetool --get-service-path pgsql
+ grep ^runpgsql= /etc/synoinfo.conf
+ eval runpgsql="yes"
+ runpgsql=yes
+ grep ^maxdisks= /etc.defaults/synoinfo.conf
+ eval maxdisks="5"
+ maxdisks=5
+ [ 5 -eq 0 ]
+ basename /usr/syno/etc/rc.d/S20pgsql.sh
+ echo usage: S20pgsql.sh {start|stop|restart|reload|status}
usage: S20pgsql.sh {start|stop|restart|reload|status}
+ exit 64
DiskStation> cat /usr/syno/etc/rc.d/S20pgsql.sh
#!/bin/sh
# For postmaster startup options, edit $PGDATA/postgresql.conf
#
# Note that PGDATA is set in ~pgsql/.profile, don't try to manipulate it here!
#
PREFIX=/usr/syno/pgsql
PGBIN=${PREFIX}/bin
POSTGRESQL_CONF=${PREFIX}/etc/postgresql.conf
PGHBA_CONF=${PREFIX}/etc/pg_hba.conf
MY_VERSION="8.3"
MY_PLATFORM=`/bin/get_key_value /etc.defaults/synoinfo.conf unique | cut -d'_' -f2`
CMD_GET_PG_PATH="/usr/syno/bin/servicetool --get-service-path pgsql"
eval $(grep "^runpgsql=" /etc/synoinfo.conf)
eval $(grep "^maxdisks=" /etc.defaults/synoinfo.conf)
if [ ${maxdisks} -eq 0 ]; then
DISKLESS="yes"
fi
FuncInitialEnv()
{
chmod 755 /var
}
FuncInitialDB()
{
if [ "${runpgsql}" != "yes" ]; then
exit 1;
fi
FuncInitialEnv
PGDATA=`$CMD_GET_PG_PATH`
ret=$?
if [ $ret -eq 0 ]; then
echo "No volume to start pgSQL..."
exit 1;
fi
SZF_VERSION="${PGDATA}/PG_VERSION"
SZF_PLATFORM="${PGDATA}/PG_PLATFORM"
if [ -d ${PGDATA} ]; then
VERSION=`cat ${SZF_VERSION} 2>/dev/null`
PLATFORM=`cat ${SZF_PLATFORM} 2>/dev/null`
if [ "$VERSION" != "$MY_VERSION" ]; then
echo "Database version is not matched ($VERSION)"
echo "Removing old databases"
rm -rf ${PGDATA}/*
elif [ "$PLATFORM" != "$MY_PLATFORM" ]; then
echo "Database platform is not matched ($PLATFORM)"
echo "Removing old databases"
rm -rf ${PGDATA}/*
fi
fi
if [ ! -d ${PGDATA}/base ]; then
echo "Initial PostgreSQL database"
chown admin:users ${PGDATA}
if [ "x${DISKLESS}" = "xyes" ]; then
tar zxf /usr/syno/pgsql/etc/pgsql.tgz -C ${PGDATA}
else
su -l admin -c "/usr/syno/pgsql/bin/initdb --pgdata=${PGDATA} --auth=md5" >/dev/null 2>&1
fi
echo "$MY_PLATFORM" > ${SZF_PLATFORM}
# we have our config files in /usr/syno/pgsql/etc/
rm ${PGDATA}/postgresql.conf ${PGDATA}/pg_hba.conf
# sleep 1 to make sure database created and the daemon is down.
sync
sleep 1
fi
}
FuncCheckDB()
{
PG_UPGRADE_DIR="/.@pgsql_upgrade"
if [ ! -d "$PG_UPGRADE_DIR" ]; then
PG_UPGRADE_DIR=`ls -d /volume[0-9]*/.@pgsql_upgrade 2>/dev/null`
fi
if [ -d "$PG_UPGRADE_DIR" ]; then
echo "**********************************************************"
echo "Found PostgreSQL upgrade dir at $PG_UPGRADE_DIR"
echo "**********************************************************"
if [ -s $PG_UPGRADE_DIR/roundcubemail.sql ]; then
su -l admin -c "/usr/syno/pgsql/bin/createuser -SDR roundcube" >/dev/null 2>&1
fi
for sql in `ls $PG_UPGRADE_DIR`;
do
echo "=========================================================="
echo "Restoring $sql ..."
echo "=========================================================="
su -l admin -c "/usr/syno/pgsql/bin/psql postgres < $PG_UPGRADE_DIR/$sql" >/dev/null 2>&1
done
rm -rf $PG_UPGRADE_DIR
fi
#photo station
SupportPS=`/bin/get_key_value /etc.defaults/synoinfo.conf supportphoto`
case "$SupportPS" in
[Yy][Ee][Ss])
/usr/syno/synoman/phpsrc/sql.sh
;;
*)
echo "Photo Station is not support here."
;;
esac
#media server
/usr/syno/bin/mediaserver.sh start
}
case $1 in
start)
FuncInitialDB
[ -x ${PGBIN}/pg_ctl ] && {
echo "Starting PostgreSQL..."
su -l admin -c \
"[ -d ${PGDATA} ] && exec ${PREFIX}/bin/pg_ctl -D ${PGDATA} start -s -w -o \"--config_file=${POSTGRESQL_CONF} --hba_file=${PGHBA_CONF}\"" >/dev/null 2>&1
}
FuncCheckDB
;;
stop)
[ -x ${PGBIN}/pg_ctl ] && {
echo "Stopping PostgreSQL..."
su -l admin -c "exec ${PREFIX}/bin/pg_ctl stop -s -m fast" >/dev/null 2>&1
}
;;
restart)
FuncInitialDB
[ -x ${PGBIN}/pg_ctl ] && {
exec su -l admin -c "exec ${PREFIX}/bin/pg_ctl -D ${PGDATA} restart -s -m fast -o \"--config_file=${POSTGRESQL_CONF} --hba_file=${PGHBA_CONF}\"" >/dev/null 2>&1
}
;;
reload)
FuncInitialDB
[ -x ${PGBIN}/pg_ctl ] && {
exec su -l admin -c "exec ${PREFIX}/bin/pg_ctl reload" >/dev/null 2>&1
}
;;
status)
[ -x ${PGBIN}/pg_ctl ] && {
exec su -l admin -c "exec ${PREFIX}/bin/pg_ctl status" >/dev/null 2>&1
}
;;
*)
echo "usage: `basename $0` {start|stop|restart|reload|status}" >&2
exit 64
;;
esac
DiskStation> ps | grep postgres
4894 root 2460 S grep postgres
DiskStation> ps | grep dms
4959 root 2460 S grep dms
DiskStation> ps | grep lighttpd
4170 root 7440 S /usr/syno/sbin/lighttpd -f /usr/syno/mediaserver/lig
4961 root 2460 S grep lighttpd
DiskStation>
da fehlt noch start am Ende der Zeile.sh -x /usr/syno/etc/rc.d/S20pgsql.sh
sh -x /usr/syno/etc/rc.d/S20pgsql.sh start
Hallo,
da fehlt noch start am Ende der Zeile.
Rich (BBCode):sh -x /usr/syno/etc/rc.d/S20pgsql.sh start
Gruß Götz
DiskStation> sh -x /usr/syno/etc/rc.d/S20pgsql.sh start
+ PREFIX=/usr/syno/pgsql
+ PGBIN=/usr/syno/pgsql/bin
+ POSTGRESQL_CONF=/usr/syno/pgsql/etc/postgresql.conf
+ PGHBA_CONF=/usr/syno/pgsql/etc/pg_hba.conf
+ MY_VERSION=8.3
+ /bin/get_key_value /etc.defaults/synoinfo.conf unique
+ cut -d_ -f2
+ MY_PLATFORM=x86
+ CMD_GET_PG_PATH=/usr/syno/bin/servicetool --get-service-path pgsql
+ grep ^runpgsql= /etc/synoinfo.conf
+ eval runpgsql="yes"
+ runpgsql=yes
+ grep ^maxdisks= /etc.defaults/synoinfo.conf
+ eval maxdisks="5"
+ maxdisks=5
+ [ 5 -eq 0 ]
+ FuncInitialDB
+ [ yes != yes ]
+ FuncInitialEnv
+ chmod 755 /var
+ /usr/syno/bin/servicetool --get-service-path pgsql
+ PGDATA=/var/services/pgsql
+ ret=1
+ [ 1 -eq 0 ]
+ SZF_VERSION=/var/services/pgsql/PG_VERSION
+ SZF_PLATFORM=/var/services/pgsql/PG_PLATFORM
+ [ -d /var/services/pgsql ]
+ cat /var/services/pgsql/PG_VERSION
+ VERSION=8.3
+ cat /var/services/pgsql/PG_PLATFORM
+ PLATFORM=x86
+ [ 8.3 != 8.3 ]
+ [ x86 != x86 ]
+ [ ! -d /var/services/pgsql/base ]
+ [ -x /usr/syno/pgsql/bin/pg_ctl ]
+ echo Starting PostgreSQL...
Starting PostgreSQL...
+ su -l admin -c [ -d /var/services/pgsql ] && exec /usr/syno/pgsql/bin/pg_ctl -D /var/services/pgsql start -s -w -o "--config_file=/usr/syno/pgsql/etc/postgresql.conf --hba_file=/usr/syno/pgsql/etc/pg_hba.conf"
+ FuncCheckDB
+ PG_UPGRADE_DIR=/.@pgsql_upgrade
+ [ ! -d /.@pgsql_upgrade ]
+ ls -d /volume[0-9]*/.@pgsql_upgrade
+ PG_UPGRADE_DIR=
+ [ -d ]
+ /bin/get_key_value /etc.defaults/synoinfo.conf supportphoto
+ SupportPS=yes
+ /usr/syno/synoman/phpsrc/sql.sh
Update blog_config table in blog db where config_id = 0 to test blog db existence
Update photo log table where log id = 0 to test db existence
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
su: can't chdir to home directory '/var/services/homes/admin'
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Failed to create database
Update photoImage table to test new table existence
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update email in photo_user table to test email existence
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update version in photo_image table to test version existence
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update photo_config table in photo db where config_id = 0 to test photo_config table existence
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update is_subdir in photo_share table to test new columns existence
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update photo_upload_right table in photo db to test photo_upload_right table existence.
Create create_time index on photo_image
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Create path index on photo_image
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
+ /usr/syno/bin/mediaserver.sh start
Update media type table where type id = 0 to test db existence
su: can't chdir to home directory '/var/services/homes/admin'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
su: can't chdir to home directory '/var/services/homes/admin'
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Failed to create database
DiskStation>
Hallo,
ob es seine Richtigkeit hat, daß versucht wird auf /var/services/homes/admin zuzugreifen, weiß ich nicht. Hast Du User homes eingeschaltet? Wenn nein, schalte es mal ein und probiere noch einmal.
Gruß Götz
BusyBox v1.16.1 (2010-11-02 18:09:22 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
DiskStation> sh -x /usr/syno/etc/rc.d/S20pgsql.sh start
+ PREFIX=/usr/syno/pgsql
+ PGBIN=/usr/syno/pgsql/bin
+ POSTGRESQL_CONF=/usr/syno/pgsql/etc/postgresql.conf
+ PGHBA_CONF=/usr/syno/pgsql/etc/pg_hba.conf
+ MY_VERSION=8.3
+ /bin/get_key_value /etc.defaults/synoinfo.conf unique
+ cut -d_ -f2
+ MY_PLATFORM=x86
+ CMD_GET_PG_PATH=/usr/syno/bin/servicetool --get-service-path pgsql
+ grep ^runpgsql= /etc/synoinfo.conf
+ eval runpgsql="yes"
+ runpgsql=yes
+ grep ^maxdisks= /etc.defaults/synoinfo.conf
+ eval maxdisks="5"
+ maxdisks=5
+ [ 5 -eq 0 ]
+ FuncInitialDB
+ [ yes != yes ]
+ FuncInitialEnv
+ chmod 755 /var
+ /usr/syno/bin/servicetool --get-service-path pgsql
+ PGDATA=/var/services/pgsql
+ ret=1
+ [ 1 -eq 0 ]
+ SZF_VERSION=/var/services/pgsql/PG_VERSION
+ SZF_PLATFORM=/var/services/pgsql/PG_PLATFORM
+ [ -d /var/services/pgsql ]
+ cat /var/services/pgsql/PG_VERSION
+ VERSION=8.3
+ cat /var/services/pgsql/PG_PLATFORM
+ PLATFORM=x86
+ [ 8.3 != 8.3 ]
+ [ x86 != x86 ]
+ [ ! -d /var/services/pgsql/base ]
+ [ -x /usr/syno/pgsql/bin/pg_ctl ]
+ echo Starting PostgreSQL...
Starting PostgreSQL...
+ su -l admin -c [ -d /var/services/pgsql ] && exec /usr/syno/pgsql/bin/pg_ctl -D /var/services/pgsql start -s -w -o "--config_file=/usr/syno/pgsql/etc/postgresql.conf --hba_file=/usr/syno/pgsql/etc/pg_hba.conf"
+ FuncCheckDB
+ PG_UPGRADE_DIR=/.@pgsql_upgrade
+ [ ! -d /.@pgsql_upgrade ]
+ ls -d /volume[0-9]*/.@pgsql_upgrade
+ PG_UPGRADE_DIR=
+ [ -d ]
+ /bin/get_key_value /etc.defaults/synoinfo.conf supportphoto
+ SupportPS=yes
+ /usr/syno/synoman/phpsrc/sql.sh
Update blog_config table in blog db where config_id = 0 to test blog db existence
Update photo log table where log id = 0 to test db existence
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Failed to create database
Update photoImage table to test new table existence
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update email in photo_user table to test email existence
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update version in photo_image table to test version existence
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update photo_config table in photo db where config_id = 0 to test photo_config table existence
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update is_subdir in photo_share table to test new columns existence
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Update photo_upload_right table in photo db to test photo_upload_right table existence.
Create create_time index on photo_image
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Create path index on photo_image
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
+ /usr/syno/bin/mediaserver.sh start
Update media type table where type id = 0 to test db existence
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Failed to create database
DiskStation>
Wer ganz vorsichtig sein will, benennt erst einmal alle Scripts unter /opt/etc/init.d/ von gross "S" nach klein "s" am Anfang um und startet seine DS erst einmal neu. Danach wird ein Script nach dem anderen wieder nach gross "S" umbenannt, wenn es denn gebraucht wird und die DS neu gestartet.
Hallo,
was sagt
Rich (BBCode):mount ls -la /
Gruß Götz
DiskStation> mount
/dev/root on / type ext4 (rw,relatime,barrier=0,journal_checksum,data=ordered)
/tmp on /tmp type tmpfs (0)
none on /dev/pts type devpts (gid=4,mode=620)
/sys on /sys type sysfs (0)
/proc/bus/usb on /proc/bus/usb type usbfs (0)
/dev/vg1/lv on /volume1 type ext3 (usrquota,grpquota)
/dev/md3 on /volume2 type ext4 (usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0,synoacl)
DiskStation> mount
/dev/root on / type ext4 (rw,relatime,barrier=0,journal_checksum,data=ordered)
/tmp on /tmp type tmpfs (0)
none on /dev/pts type devpts (gid=4,mode=620)
/sys on /sys type sysfs (0)
/proc/bus/usb on /proc/bus/usb type usbfs (0)
/dev/vg1/lv on /volume1 type ext3 (usrquota,grpquota)
/dev/md3 on /volume2 type ext4 (usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0,synoacl)
DiskStation> ls -la /
drwxr-xr-x 23 root root 4096 Jan 8 13:42 .
drwxr-xr-x 23 root root 4096 Jan 8 13:42 ..
-rw------- 1 root root 1024 Jan 2 19:19 .rnd
drwxr-xr-x 2 root root 4096 Jan 2 19:13 bin
drwxr-xr-x 8 root root 36864 Jan 8 13:42 dev
drwxr-xr-x 15 root root 4096 Jan 8 13:42 etc
drwxr-xr-x 13 root root 4096 Jan 8 13:42 etc.defaults
drwxr-xr-x 2 root root 4096 Nov 2 13:58 initrd
drwxr-xr-x 14 root root 12288 Jan 2 19:13 lib
drwxr-xr-x 2 root root 4096 Jan 2 19:13 lib64
lrwxrwxrwx 1 root root 11 Jan 2 19:13 linuxrc -> bin/busybox
drwx------ 2 root root 4096 Nov 2 13:55 lost+found
drwxr-xr-x 2 root root 4096 Nov 2 13:29 mnt
drwxr-xr-x 2 root root 4096 Jan 8 12:57 opt
dr-xr-xr-x 152 root root 0 Jan 8 13:42 proc
drwxr-xr-x 2 root root 4096 Jan 2 19:13 root
drwxr-xr-x 2 root root 4096 Jan 2 19:13 sbin
drwxr-xr-x 12 root root 0 Jan 8 13:42 sys
drwxrwxrwt 7 root root 880 Jan 8 14:13 tmp
drwxr-xr-x 7 root root 4096 Jan 2 23:16 usr
drwxr-xr-x 12 root root 4096 Jan 8 13:42 var
drwxr-xr-x 12 root root 4096 Jan 2 19:14 var.defaults
drwxr-xr-x 17 root root 4096 Jan 8 13:42 volume1
drwxr-xr-x 4 root root 4096 Jan 8 13:42 volume2
drwxr-xr-x 2 root root 4096 Jan 5 06:38 volumeUSB1
DiskStation>
Wer ganz vorsichtig sein will, benennt erst einmal alle Scripts unter /opt/etc/init.d/ von gross "S" nach klein "s" am Anfang um und startet seine DS erst einmal neu. Danach wird ein Script nach dem anderen wieder nach gross "S" umbenannt, wenn es denn gebraucht wird und die DS neu gestartet. Wenn man die nicht benötigten Startup Scripte weglässt, hat das gleich noch den Vorteil, dass man etwas entrümpelt, falls doch alzu viele IPK Dienste bereits ihren Weg auf die DS gefunden haben.
Zusätzlich kann man mit dieser Vorgehensweise sehr klar feststellen, wo es hakt.
Wenn du das Forum hilfreich findest oder uns unterstützen möchtest, dann gib uns doch einfach einen Kaffee aus.
Als Dankeschön schalten wir deinen Account werbefrei.