public static void main(String[] args) {
        try {
            Sys.savePID(new ClinicClient().getPidFile());
            Log.init();
            App form = new App();

            form.setUploadRunnable(new Runnable() {
                @Override
                public void run() {
                    try {
                        Application.upload();
                    } catch (Exception e) {
                        Log.write(e);
                    }
                }
            });

            form.setUpdateRunnable(new Runnable() {
                @Override
                public void run() {
                    try {
                        Runtime.getRuntime().exec(
                                Sys.getStartJarCommand(new ClientUpdater().getFile().getName()) + " --force"
                        );
                    } catch (Exception e) {
                        Log.write(e);
                    }
                }
            });

            new Thread(new Runnable() {
                @Override
                public void run() {
                    long lastModified = 0;

                    while (true) {
                        try {
                            File filesDirectory = new File(config.getPath());
                            long directoryModified = filesDirectory.lastModified();

                            if (lastModified < directoryModified) {
                                lastModified = directoryModified;
                                Log.write(Message.MESSAGE_DIRECTORY_MODIFIED);
                                Application.upload();
                            }

                            Thread.sleep(300000);
                        } catch (Exception e) {
                            Log.write(e);
                        }
                    }
                }
            }).start();

            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        Application.configure();

                        while (true) {
                            Log.write(Message.MESSAGE_SEND_PING);
                            ApiClient.getInstance().ping(Config.VERSION);
                            Thread.sleep(86400 * 1000);
                        }
                    } catch (InterruptedException e) {
                        Log.write(e);
                    } catch (Exception e) {
                        Log.write(e);
                    }
                }
            }).start();
        } catch (Exception e) {
            Log.write(e);
        }
    }