瀚高数据库开机自启动失败

问题描述:使用瀚高数据库企业版,开机自启动没有正常运行。
使用命令

[root@hgdb ~]$ systemctl start hgdb-see-4.5.8.service

现象:

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root (tbs)
Password: 
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to start hgdb-see-4.5.8.service: Access denied
See system logs and 'systemctl status hgdb-see-4.5.8.service' for details.

一般出现access denied是参数设置错误造成的,所以有以下解决思路,也顺利解决了问题。
解决办法:

[root@localhost system]# cd /usr/lib/systemd/system/
[root@localhost system]# vim hgdb-see-4.5.8.service 

文件内容如下:

[Unit]
Description=hgdb
Requires=network.target local-fs.target
After=network.target local-fs.target
[Service]
Type=forking
User=root
ExecStart=/bin/bash -c "/opt/highgo/hgdb-see-4.5.8/bin/service.sh start"
ExecStop=/bin/bash -c "/opt/highgo/hgdb-see-4.5.8/bin/service.sh stop"
TimeoutSec=60
[Install]
WantedBy=multi-user.target graphical.target
[root@localhost system]# vim /opt/highgo/hgdb-see-4.5.8/bin/service.sh
#/bin/bash -e

PROGNAME=$(basename $0)
BIN=$(dirname "$0")
PKGTYPE=$([ `which dpkg 2> /dev/null` ] && echo deb || echo rpm)

if [[ $# != 1 ]]; then
    echo "Usage: $PROGNAME {start|stop|restart|status}" >&2
    exit 1
fi

if [[ $PKGTYPE == 'rpm' ]]; then
    source /etc/profile
    [[ -f ~/.bashrc ]] && source ~/.bashrc
    [[ -f ~/.bash_profile ]] && source ~/.bash_profile
else
    eval "`cat /etc/profile`"
    [[ -f ~/.bashrc ]] && eval "`cat ~/.bashrc`"
    [[ -f ~/.bash_profile ]] && eval "`cat ~/.bash_profile`"
fi

if [[ $PGDATA == '' ]]; then
    pgconf=`find $BIN/.. -name postgresql.conf | head -n 1`
    if [[ $pgconf ]]; then
        export PGDATA=`dirname $pgconf`
    else
        echo "Cannot find datadir"
        exit 1
    fi
fi

case $1 in
    start) 
        $BIN/pg_ctl start -D /data/highgo/data/
        exit
        ;;
    stop) 
        $BIN/pg_ctl stop
        exit
        ;;
    restart) 
        $BIN/pg_ctl restart
        exit
        ;;
    status) 
        $BIN/pg_ctl status
        exit
        ;;
    *) 
        echo "Invalid argument" >&2
        exit 1
        ;;
esac

修改

$BIN/pg_ctl start 为 $BIN/pg_ctl start -D /data/highgo/data/

-D /data/highgo/data/是data路径

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

三月微风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值