XIYO
Occasional Visitor
Here's the English translation of your text:
Hello, I'm trying to run pgsql on my AC88U(386.11) router.
I know it may not be the best idea, but I want to give it a try.
## I've encountered several issues but have managed to resolve them all.
- Search for `pgsql` in opkg, not `postgresql`.
- `pg_ctl` cannot be run as the root user, so you have to use the `-U` option to change the user.
- Accounts get reset, so I had to create scripts to register accounts (passwd.add, group.add... etc.)
- `pg_ctl` logs issues upon running, so where it is run from is also important.
I've resolved various issues, including allowing external access, and have successfully launched the service.
## Now, the final challenge remains.
### The first method successfully launches the service.
	
	
	
		
### The second method also successfully launches the service.
I've also modified S98postgresql, and it runs well (although the logs aren't pretty...).
S98postgresql
	
	
	
		
	
	
	
		
This command works fine.
My final challenge is to ensure that the service starts automatically after a reboot.
In /jffs/script/services-start,
	
	
	
		
I've written it like this, but while the nginx I installed for comparison starts normally, PostgreSQL does not. I suspect it's a permissions issue, but I don't even know how to check the logs...
Any help would be greatly appreciated.
I wish everyone a happy day.
				
			Hello, I'm trying to run pgsql on my AC88U(386.11) router.
I know it may not be the best idea, but I want to give it a try.
## I've encountered several issues but have managed to resolve them all.
- Search for `pgsql` in opkg, not `postgresql`.
- `pg_ctl` cannot be run as the root user, so you have to use the `-U` option to change the user.
- Accounts get reset, so I had to create scripts to register accounts (passwd.add, group.add... etc.)
- `pg_ctl` logs issues upon running, so where it is run from is also important.
I've resolved various issues, including allowing external access, and have successfully launched the service.
## Now, the final challenge remains.
### The first method successfully launches the service.
		Code:
	
	# In a directory where 'postgres' has write permission
pg_ctl -U postgres -D /mnt/sda1/entware-data/var/pgsql start
	### The second method also successfully launches the service.
I've also modified S98postgresql, and it runs well (although the logs aren't pretty...).
S98postgresql
		Code:
	
	#!/bin/sh
# Installation prefix
prefix="/mnt/sda1/entware-data"
# Data directory
PGDATA="$prefix/var/pgsql"
PG_DUMP_DIR="$prefix/var/pgsql/15.2/dump"
# Who to run the postmaster as, usually "postgres".  (NOT "root")
PGUSER=postgres
# Where to keep a log file
PGLOG="$PGDATA/serverlog"
# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="/opt/bin/pg_ctl"
#########
if [ -z "$1" ] ; then
    case `echo "$0" | /bin/sed 's:^.*/\(.*\):\1:g'` in
        S??*) rc="start" ;;
        K??*) rc="stop" ;;
        *) rc="usage" ;;
    esac
else
    rc="$1"
fi
case "$rc" in
    start)
        echo -n "Starting PostgreSQL: "
        cd $PGDATA
        $DAEMON -U $PGUSER -D $PGDATA -l $PGLOG start
        echo ok
        ;;
    stop)
        echo -n "Stopping PostgreSQL: "
        $DAEMON -U $PGUSER -D $PGDATA stop
        echo ok
        ;;
    restart)
        echo -n "Restart POstgreSQL: "
        $DAEMON -U $PGUSER -D $PGDATA restart
        echo ok
        ;;
    dumpall)
        PG_DUMP_FILE=$PG_DUMP_DIR/dumpall-`date +%FT%H%M%S`
        if [ -x $prefix/bin/gzip ]; then
            PG_DUMP_FILE=$PG_DUMP_FILE.gz
            echo -n "PostgreSQL pg_dumpall and gzip to $PG_DUMP_FILE "
            su - $PGUSER -c "$prefix/bin/pg_dumpall | $prefix/bin/gzip -c > $PG_DUMP_FILE"
        else
            echo -n "PostgreSQL pg_dumpall to $PG_DUMP_FILE "
            su - $PGUSER -c "$prefix/bin/pg_dumpall > $PG_DUMP_FILE"
        fi
        echo ok
        ;;
    *)
        echo "Usage: $0 (start|stop|restart|dumpall|usage)"
        ;;
esac
	
		Code:
	
	/opt/etc/init.d/S98postgresql start
	My final challenge is to ensure that the service starts automatically after a reboot.
In /jffs/script/services-start,
		Code:
	
	#!/bin/sh
/jffs/addons/amtm/shellhistory # Added by amtm
/opt/etc/init.d/rc.unslung start # Added by xiyo
	I've written it like this, but while the nginx I installed for comparison starts normally, PostgreSQL does not. I suspect it's a permissions issue, but I don't even know how to check the logs...
Any help would be greatly appreciated.
I wish everyone a happy day.
	