1

How to autostart a task at system start up i.e. myprogram.bin with admin rights?

Regards

1 Answers1

1

The easiest way to run a command with root privileges at reboot is to put it in the root 'cron' using the special time @reboot. To do this, execute the command:

sudo crontab -e

And add a line

@reboot /path/to/myprogram.bin

You could append 2>&1 > /path/to/log_file.txt to send all output and error messages to a log file. By default, outputs from cron jobs are emailed to the root user which tends not to be terribly useful. Or you could configure your server to forward root emails to your own account.

nickcrabtree
  • 1,194
  • 11
  • 19