1

I want to run a simple command after boot.

cd /mypath
# then
./mycommand

How can I do it?

Zanna
  • 67,317
  • 54
  • 206
  • 318
Hassan
  • 11
  • 1
  • 2

1 Answers1

1

Two solutions:

The first one is to put the full path of the command in /etc/rc.local:

/mypath/mycommand

or, the cron way:

crontab -e

@reboot cd /mypath;./mycommand

From the crontab manual:

 @reboot        Run once, at startup.
NerdOfLinux
  • 3,538
  • 6
  • 25
  • 51
  • `/etc/rc.local` is available for 16.04, but 17.10 and 18.04 aren't at least you make it available for systemd. – Néstor Nov 13 '18 at 15:37