MongoDB re-connect using systemd

This commit is contained in:
Sukchan Lee 2017-10-31 12:29:39 +00:00
parent a9dd6be8e8
commit 081f8c8808
7 changed files with 30 additions and 6 deletions

18
debian/changelog vendored
View File

@ -1,3 +1,21 @@
nextepc (0.2-3~artful) artful; urgency=medium
* MongoDB re-connect using systemd
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 12:10:18 +0000
nextepc (0.2-3~zesty) zesty; urgency=medium
* MongoDB re-connect using systemd
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 12:07:36 +0000
nextepc (0.2-3~xenial) xenial; urgency=medium
* MongoDB re-connect using systemd
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 12:00:16 +0000
nextepc (0.2-2~artful) artful; urgency=medium
* Fix PGW installation

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -271,7 +271,7 @@ status_t context_db_init(const char *db_uri)
if (!mongoc_client_get_server_status(self.db_client, NULL, &reply, &error))
{
d_error("Failed to conect to server [%s]", db_uri);
return CORE_ERROR;
return CORE_EAGAIN;
}
d_assert(bson_iter_init_find(&iter, &reply, "ok"),

7
main.c
View File

@ -80,6 +80,7 @@ int main(int argc, char *argv[])
*
* Keep the order of starting-up
*/
status_t rv;
char *config_path = NULL;
char *log_path = NULL;
char *pid_path = NULL;
@ -138,8 +139,12 @@ int main(int argc, char *argv[])
core_initialize();
app_log_pid(pid_path);
if (app_initialize(config_path, log_path) != CORE_OK)
rv = app_initialize(config_path, log_path);
if (rv != CORE_OK)
{
if (rv == CORE_EAGAIN)
return EXIT_SUCCESS;
d_fatal("NextEPC initialization failed. Aborted");
return EXIT_FAILURE;
}

View File

@ -49,7 +49,7 @@ status_t app_will_initialize(const char *config_path, const char *log_path)
if (rv != CORE_OK) return rv;
}
return CORE_OK;
return rv;
}
status_t app_did_initialize(void)
@ -57,7 +57,7 @@ status_t app_did_initialize(void)
status_t rv = app_logger_start();
if (rv != CORE_OK) return rv;
return CORE_OK;
return rv;
}
void app_will_terminate(void)

View File

@ -1,5 +1,6 @@
[Unit]
Description=NextEPC HSS Daemon
BindTo=mongodb.service
After=networking.service mongodb.service
[Service]
@ -12,7 +13,6 @@ RuntimeDirectory=nextepc-hssd
PIDFile=@LIB_DIR@/run/nextepc-hssd/pid
Restart=always
ExecStartPre=/bin/sleep 5
ExecStart=@BIN_DIR@/nextepc-hssd -f @SYSCONF_DIR@/nextepc/hss.conf
RestartSec=2
RestartPreventExitStatus=1

View File

@ -1,5 +1,6 @@
[Unit]
Description=NextEPC PCRF Daemon
BindTo=mongodb.service
After=networking.service mongodb.service
[Service]
@ -12,7 +13,6 @@ RuntimeDirectory=nextepc-pcrfd
PIDFile=@LIB_DIR@/run/nextepc-pcrfd/pid
Restart=always
ExecStartPre=/bin/sleep 5
ExecStart=@BIN_DIR@/nextepc-pcrfd -f @SYSCONF_DIR@/nextepc/pcrf.conf
RestartSec=2
RestartPreventExitStatus=1