File: childprocess.cc

package info (click to toggle)
ssh-cron 2.00.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 840 kB
  • sloc: cpp: 1,372; fortran: 200; makefile: 99; sh: 36; ansic: 10
file content (24 lines) | stat: -rw-r--r-- 686 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#define XERR "sshcron"
#include "sshcron.ih"

// ssh-cron, when run in the foreground, acts like when running as daemon.
// e.g., send it signals via another ssh-cron process using options like
// --list (cf. request.cc). 

    // by Fork, run.cc

void SSHCron::childProcess()
{
    if (not d_options.foreground())
        prepareDaemon();                   // Fork member
    else
        cout << "Issue a --terminate command using a separate `" <<
                                d_options.basename() << "' process" << endl;  

    Cron cron{ d_passphrase };
    d_passphrase = string{};

    cron.fork();

    throw 0;                    // correctly end the child process at main
}