I have this shell command asebamedulla "ser:device=/dev/ttyACM0"
, I want it to be run directly after restarting Linux.
I read some solutions ( shell_command &
, or run in in background as a daemon process...) but I didn't know how to use them.
My question is :
how to run a shell command automatically and directly after startup?
Solution 1:
>>sudo crontab -e
#In the first line of this file enter this:
@reboot <your command whatever>
#Save and Exit
Solution 2:
Make a script name it "whatever.sh".
Put the file in your /etc/init.d/ directory.
Change the permission of your file by.
chmod +x /etc/init.d/whatever.sh