Skip to content

Commit

Permalink
Merge branch 'master' into v2.0-artoria
Browse files Browse the repository at this point in the history
  • Loading branch information
holishing committed Nov 27, 2019
2 parents 678bd68 + f1148f2 commit b0317b1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
15 changes: 12 additions & 3 deletions maple/bbsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -1442,7 +1444,7 @@ start_daemon(
/* mport = port; */ /* Thor.990325: 不需要了: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;
}

Expand Down Expand Up @@ -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);
}
}


Expand Down
4 changes: 2 additions & 2 deletions sample/bbsd.service
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,4 +16,3 @@ PrivateTmp=true
[Install]
WantedBy=multi-user.target
WantedBy=xchatd.service
Requires=startbbs.service
19 changes: 19 additions & 0 deletions sample/bbsd_unixsocket.service
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b0317b1

Please sign in to comment.