/usr/syno/etc/rc.d/S25download.sh start
volume : 1
psql: could not connect to server
...
/usr/syno/etc/rc.d/S20pgsql.sh start
/usr/syno/etc/rc.d/S20pgsql.sh status
pg_ctl: server is running (PID: 8228)
Ich habe allerdings nirgends eine Möglichkeit entdeckt, den pgsql (postgresql) vom Webinterface aus zu steuern.
#!/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
FuncInitialDB()
{
Volume=`/usr/syno/bin/servicetool --get-service-path pgsql`
PG_VERSION=`cat ${Volume}/pgsql/PG_VERSION`
if [ -d ${Volume}/pgsql -a "$PG_VERSION" != "8.2" ]; then
echo "Database version is too old ($PG_VERSION)"
echo "Removing old databases"
rm -rf ${Volume}/pgsql
fi
if [ ! -d ${Volume}/pgsql ]; then
echo "Initial PostgreSQL database"
mkdir -p ${Volume}
chown admin ${Volume}
su -l admin -c "/usr/syno/pgsql/bin/initdb --pgdata=${Volume}/pgsql/ --auth=md5"
# we have our config files in /usr/syno/pgsql/etc/
rm ${Volume}/pgsql/postgresql.conf ${Volume}/pgsql/pg_hba.conf
# sleep 1 to make sure database created and the daemon is down.
sync
sleep 1
fi
}
FuncCheckDB()
{
PG_UPGRADE_DIR=`ls -d /volume[0-9]*/@pgsql_upgrade`
if [ -d "$PG_UPGRADE_DIR" ]; then
echo "**********************************************************"
echo "Found PostgreSQL upgrade dir at $PG_UPGRADE_DIR"
echo "**********************************************************"
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"
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
SupportMS=`/bin/get_key_value /etc.defaults/synoinfo.conf supportmediaservice`
case "$SupportMS" in
[Yy][Ee][Ss])
/usr/syno/bin/mediaserver.sh start
;;
*)
echo "Media Server is not support here."
;;
esac
}
case $1 in
start)
FuncInitialDB
Volume=`/usr/syno/bin/servicetool --get-service-path pgsql`
[ -x ${PGBIN}/pg_ctl ] && {
echo "Starting PostgreSQL..."
PGDATA="${Volume}/pgsql/"
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}\""
}
FuncCheckDB
;;
stop)
[ -x ${PGBIN}/pg_ctl ] && {
echo "Stopping PostgreSQL..."
su -l admin -c "exec ${PREFIX}/bin/pg_ctl stop -s -m fast"
}
;;
restart)
FuncInitialDB
Volume=`/usr/syno/bin/servicetool --get-service-path pgsql`
[ -x ${PGBIN}/pg_ctl ] && {
PGDATA="${Volume}/pgsql/"
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}\""
}
;;
reload)
FuncInitialDB
[ -x ${PGBIN}/pg_ctl ] && {
exec su -l admin -c "exec ${PREFIX}/bin/pg_ctl reload"
}
;;
status)
[ -x ${PGBIN}/pg_ctl ] && {
exec su -l admin -c "exec ${PREFIX}/bin/pg_ctl status"
}
;;
*)
echo "usage: `basename $0` {start|stop|restart|reload|status}" >&2
exit 64
;;
esac
#!/bin/sh
# Copyright (c) 2000-2006 Synology Inc. All rights reserved.
Scheduler="/usr/syno/sbin/scheduler"
PidFile="/var/run/scheduler.pid"
case $1 in
"start")
SupportDL=`/bin/get_key_value /etc.defaults/synoinfo.conf support_download`
case "$SupportDL" in
[Yy][Ee][Ss])
;;
*)
echo "Download Station is not support here."
exit
;;
esac
EnableDL=`/bin/get_key_value /etc/synoinfo.conf download_enabled`
EnableDLUPnP=`/bin/get_key_value /etc/synoinfo.conf download_port_map_enabled`
if [ "$EnableDL" = "yes" ] && [ "$EnableDLUPnP" = "yes" ]; then
StartPort=`/bin/get_key_value /etc/synoinfo.conf download_start_port`
if [ -z "$StartPort" ] || [ "$StartPort" = "0" ]; then
StartPort=6881;
fi
EndPort=`expr $StartPort + 10`
/usr/syno/bin/synoupnp -d $StartPort-$EndPort -o /var/tmp/download_port_map.log
fi
/usr/syno/bin/servicetool --get-service-volume download
VolHome=$?
if [ $VolHome -eq 0 ]; then
echo "Download hasn't set its' volume, let user to choose..."
else
[ -d /volume${VolHome}/@download ] || mkdir /volume${VolHome}/@download
fi
su -l admin -c "/usr/syno/pgsql/bin/psql download -c \"select 1 from sysconf\""
Ret=$?
if [ $Ret != 0 ]; then
if [ $Ret = 1 ]; then
echo "Drop old database"
su -l admin -c "/usr/syno/pgsql/bin/dropdb download"
if [ $? != 0 ]; then
echo "Failed to drop old database"
exit
fi
fi
fi
echo "Update download queue table and set all pid to -1"
su -l admin -c "/usr/syno/pgsql/bin/psql download -c \"update download_queue set pid=-1\""
Ret=$?
if [ $Ret = 2 ]; then
su -l admin -c "/usr/syno/pgsql/bin/createdb download"
if [ $? != 0 ]; then
echo "Failed to create database"
exit
fi
Ret=1
fi
if [ $Ret = 1 ]; then
su -l admin -c "/usr/syno/pgsql/bin/psql download < /usr/syno/download/sql/download.pgsql"
if [ $? != 0 ]; then
echo "Failed to initial download database"
exit
fi
fi
upgrades=`find /usr/syno/download/sql/upgrade -name "*.sh" | sort`
for ThisArg in $upgrades;
do
$ThisArg
done
# Set the status TASK_DOWNLOADING, TASK_FINISHING, TASK_PRESEEDING, TASK_SEEDING to TASK_WAITING
su -l admin -c "/usr/syno/pgsql/bin/psql download -c \"update download_queue set status=1 where status=2 or status=4 or status=7 or status=8\""
echo "Starting Download Station scheduler daemon ..."
$Scheduler
;;
"stop")
[ -f "$PidFile" ] || exit
Pid=`cat $PidFile`
echo "Stopping scheduler ..."
kill -TERM $Pid > /dev/null 2>&1
# check whether the scheduler is alive
Count=1
IsAlive=1
while [ $Count -le 20 ]
do
kill -0 $Pid > /dev/null 2>&1
if [ $? = 1 ]; then
IsAlive=0
break;
fi
Count=`expr $Count + 1`
sleep 1
done
if [ $IsAlive = 1 ]; then
echo "Unusual situation: kill scheduler and rtorrent forcedly" >> /var/log/messages
killall -9 scheduler > /dev/null 2>&1
killall -9 rtorrent > /dev/null 2>&1
fi
;;
"restart")
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 start|stop|restart"
;;
esac
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.
Du bist nicht hier, um Support für Adblocker zu erhalten. Dein Adblocker funktioniert bereits ;-)
Klar machen Adblocker einen guten Job, aber sie blockieren auch nützliche Funktionen.
Das Forum wird mit hohem technischen, zeitlichen und finanziellen Aufwand kostenfrei zur Verfügung gestellt. Wir zeigen keine offensive Werbung und bemühen uns um eine dezente Integration.
Bitte unterstütze dieses Forum, in dem du deinen Adblocker für diese Seite deaktivierst.
Du kannst uns auch über unseren Kaffeautomat einen Kaffe ausgeben oder ein PUR Abo abschließen und das Forum so werbefrei nutzen.
Vielen Dank für Deine Unterstützung!