0

I type sudo -i to proceed to edit commands of crontab.

I've written the following line inside the file of crontab.

@reboot cd /home/username/superuser && cargo run;

The following content is inside the main.rs of the normal cargo.

use std::fs;

fn main() {
    let data = "rust language";
    fs::write("/home/username/foo", data).expect("Unable to write file");
}

As I reboot my computer , actually the file foo was not generated in a directory.

What is(/are) cause(s)?

Saaransh Garg
  • 2,596
  • 14
  • 27

1 Answers1

0

As only the objective is to execute a program file, then one can run the that file with crontab with @reboot /home/username/path/to/cargo/package/target/filename