![]() Next, you need to enable the systemd service to run on boot, using the following command: In case you're not familiar with Nano text editor, you can save the file by pressing Ctrl + o, then Enter. Don't add sudo at the beginning of the command or script, because it runs as root anyway. ![]() Here, change the Description value to describe what this does, and the ExecStart value to the command or path of the script you want to run as root on startup. In this file, paste the following: ĮxecStart=/path/to/command/or/script We can use Nano command line text editor to open / create this file: To use systemd to run a command or script as root when your computer boots, create a file (as root) called rvice (replace mycommand with whatever you want to call it) in /etc/systemd/system/. How to use systemd to run a command or script as root on boot This article explains how to run a command or script at startup / boot as root on Linux, in two ways: using systemd or a cron job.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |