Skip to content

Sending notification on behalf or another process #7

@PradeepKiruvale

Description

@PradeepKiruvale

Hi,

I am using this crate for sending the notifications to systemd on behalf of another process.
Below is my code snippet that is used for sending the notification. I collect the process ID of the process to be monitored by the watchdog program and send the notification to the systemd on behalf of that process. The code runs fine, without any errors. But the notifications are not reaching the system. So, the systemd keeps restarting the service after watchdog timeout. Please help me am I doing the right thing here or not.

fn notify_systemd(pid: u32) {

let result = sd_notify::notify(true, &[NotifyState::MainPid(pid)]);

dbg!(&result);

match result {

    Ok(()) => {

        println!("notify pid: {}", pid);
    }

    Err(e) => {
        println!("error: {:?}", e.to_string());
    }

}

Thanks,
Pradeep

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions