To set a command to automatically run when the Linux system starts using systemctl
,
you can create a new service file for the command and then enable it.
- Create a new file in the
/etc/systemd/system/
directory, for example,filezilla-server.service
. - Add the following content to the file, replacing
/path/to/command
with the actual path to the command you want to run:
- Run the following command to reload the systemd configuration:
sudo systemctl daemon-reload
- Start the service with the following command:
sudo systemctl start filezilla-server.service
- Enable the service to start at boot with:
sudo systemctl enable filezilla-server.service
Now the filezilla-server will start automatically on system boot.
This is a Common structure for apply any application
To set a command to automatically run when the Linux system starts, you can create a new service file for the command and then enable it using systemctl
, or you can create a new script and add it to the system's init or systemd startup scripts.
- Create a new file in the
/etc/systemd/system/
directory, for example,mycommand.service
. - Add the following content to the file, replacing
/path/to/command
with the actual path to the command you want to run:
- Run the following command to reload the systemd configuration:
sudo systemctl daemon-reload
- Start the service with the following command:
sudo systemctl start mycommand.service
- Enable the service to start at boot with:
sudo systemctl enable mycommand.service
Another way to do it is,
- Create a new script in the
/etc/init.d/
directory, for example,mycommand
. - Add the command you want to run in the script.
- Make the script executable:
sudo chmod +x /etc/init.d/mycommand
- Add the script to the system's init or systemd startup scripts:
sudo update-rc.d mycommand defaults
Now the command will start automatically on system boot.
Hope you got the solution. you can apply this way for any softwaer auto open on ubuntu if not understand any part then message us we will help you
Thank you
0 Comments