trguapo
trguapo

Reputation: 26

C programming invoking "at command" in Linux

how could i delay or invoke echo command using at job? I want to print something at a specified time...thank you!

like echo "hello world" | at 12:00 and pass this command to system(). I already tried to update DB using "at job" and it is doing great but i want also to print something after i update it...thanks in advance! =)

Upvotes: 0

Views: 185

Answers (1)

Greg Inozemtsev
Greg Inozemtsev

Reputation: 4671

Just running echo doesn't quite make sense, since there is nowhere for the output to go (unless you redirect to a file). This example will send a broadcast message to all terminals at 12:34

#include <stdio.h>

int main()
{
    FILE *f = popen("at 1234", "w");
    fprintf(f, "echo 'Hello World' | wall");
    fclose(f);
    printf("Job scheduled\n");
    return 0;
}

Upvotes: 2

Related Questions