remove pid file mechanism.

use ps+grep or pkill.
This commit is contained in:
iratqq 2008-02-01 04:22:37 +00:00
commit 5316e05705
5 changed files with 0 additions and 54 deletions

View file

@ -856,7 +856,6 @@ SJ3VARDIR="$sj3var_dir"
AC_SUBST(SJ3VARDIR)
AC_DEFINE_UNQUOTED(CHROOTDIR, "$sj3var_dir/spool/sj3", [chrooted dir])
AC_DEFINE_UNQUOTED(SOCKETNAME, "$sj3var_dir/run/sj3serv.socket", [socket file])
AC_DEFINE_UNQUOTED(PIDFILE, "$sj3var_dir/run/sj3serv.pid", [pid file])
SJ3DICTDIR="$sj3var_dir/spool/sj3"
AC_SUBST(SJ3DICTDIR)

View file

@ -59,40 +59,6 @@ opening()
printf("Build at %s\r\n", time_stamp);
}
int
make_pidfile()
{
int fd;
char buf[BUFSIZ];
size_t len;
fd = open(pid_file, O_CREAT | O_WRONLY | O_EXCL, 0600);
if (fd < 0) {
fprintf(stderr, "can't create file '%s'\n", pid_file);
return ERROR;
}
snprintf(buf, sizeof(buf), "%d", getpid());
len = strlen(buf);
if (write(fd, buf, strlen(buf)) != len) {
fprintf(stderr, "can't write file '%s'\n", pid_file);
close(fd);
return ERROR;
}
close(fd);
if (!chroot_enable)
return 0;
return 0;
}
int
erase_pidfile()
{
return unlink(pid_file);
}
static int
signal_handler(int sig)
{
@ -129,8 +95,6 @@ server_terminate()
sj_closeall();
exit_auth();
erase_pidfile();
exit(0);
}
@ -183,13 +147,6 @@ main(int argc, char **argv)
preload_dict();
preopen_dict();
if (make_pidfile() == ERROR) {
fprintf(stderr, "already running...\n");
fflush(stderr);
exit_auth();
exit(1);
}
communicate();
close_socket();
@ -197,7 +154,5 @@ main(int argc, char **argv)
sj_closeall();
exit_auth();
erase_pidfile();
exit(0);
}

View file

@ -218,7 +218,6 @@ set_server(lua_State *lstate)
if (!check_table(lstate))
return 0;
lua2sj_boolean(lstate, "daemon", 1, FORKFLAG, &daemon_enable);
lua2sj_string(lstate, "pidfile", 1, PIDFILE, pid_file, sizeof(pid_file));
lua2sj_integer(lstate, "max_client", 1, MAXCLIENTNUM, &max_client);
lua2sj_string(lstate, "dict_dir", 1, DICTROOTDIR, dict_dir, sizeof(dict_dir));
lua2sj_string(lstate, "user", 1, SJ3OWNER, chuser_name, sizeof(chuser_name));
@ -233,7 +232,6 @@ get_server(lua_State *lstate)
{
lua_newtable(lstate);
sj2lua_boolean(lstate, "daemon", daemon_enable);
sj2lua_string(lstate, "pidfile", pid_file);
sj2lua_integer(lstate, "max_client", max_client);
sj2lua_string(lstate, "dict_dir", dict_dir);
return 1;

View file

@ -109,7 +109,6 @@ int open_debug();
void debug_out(int, const char *, ...);
/* main.c */
int make_pidfile();
void server_terminate();
extern char program_name [MAXPATHLEN];

View file

@ -21,11 +21,6 @@ sj3.set_server {
-- set daemonize
daemon = true,
-- lockfile: String
-- pid file name
-- Note: this file is created after chroot
pidfile = "/run/sj3serv.pid",
-- max_client: Integer
-- client connect limit value
max_client = 512,