diff --git a/maple/bbsd.c b/maple/bbsd.c index c5cc1268b..92c905192 100644 --- a/maple/bbsd.c +++ b/maple/bbsd.c @@ -24,6 +24,8 @@ #define QLEN 3 #define PID_FILE "run/bbs.pid" +#define PID_FILE_INET "run/bbs_inet.pid" +#define PID_FILE_UNIXSOCKET "run/bbs_unixsocket.pid" #define LOG_FILE "run/bbs.log" #undef SERVER_USAGE @@ -1442,7 +1444,7 @@ start_daemon( /* mport = port; */ /* Thor.990325: ¤£»Ý­n¤F:P */ sprintf(data, "%d\t%s\t%d\tinetd -i\n", getpid(), buf, port); - f_cat(PID_FILE, data); + f_cat(PID_FILE_INET, data); return; } @@ -1530,9 +1532,16 @@ start_daemon( setuid(BBSUID); //sprintf(data, "%d\t%s\t%d\n", getpid(), buf, port); - //f_cat(PID_FILE, data); sprintf(data, "%d\n", getpid()); - f_cat(PID_FILE, data); + + if (port == -2) + { + f_cat(PID_FILE_UNIXSOCKET, data); + } + else + { + f_cat(PID_FILE, data); + } } diff --git a/sample/bbsd.service b/sample/bbsd.service index e884f7ba7..8d18b42f6 100644 --- a/sample/bbsd.service +++ b/sample/bbsd.service @@ -1,12 +1,13 @@ [Unit] Description=DreamBBS Telnet server After=syslog.target network.target remote-fs.target nss-lookup.target +Requires=startbbs.service [Service] Type=forking PIDFile=/home/bbs/run/bbs.pid ExecStart=/home/bbs/bin-2.0/bbsd 23 & -ExecStop=/bin/kill -s QUIT $MAINPID +ExecStop=/bin/kill -s TERM $MAINPID Restart=on-failure RestartSec=42s KillMode=process @@ -15,4 +16,3 @@ PrivateTmp=true [Install] WantedBy=multi-user.target WantedBy=xchatd.service -Requires=startbbs.service diff --git a/sample/bbsd_unixsocket.service b/sample/bbsd_unixsocket.service new file mode 100644 index 000000000..8b8c9d4ef --- /dev/null +++ b/sample/bbsd_unixsocket.service @@ -0,0 +1,19 @@ +[Unit] +Description=DreamBBS Unixsocket server +After=syslog.target network.target remote-fs.target nss-lookup.target +Requires=startbbs.service + +[Service] +User=bbs +Group=bbs +Type=forking +PIDFile=/home/bbs/run/bbs_unixsocket.pid +ExecStart=/home/bbs/bin/bbsd -u run/bbsd.socket & +ExecStop=/bin/kill -s TERM $MAINPID +Restart=on-failure +RestartSec=42s +KillMode=process +PrivateTmp=true + +[Install] +WantedBy=multi-user.target